github.com/dkishere/pop@v4.13.1+incompatible/dialect_test.go (about)

     1  package pop
     2  
     3  import (
     4  	"bytes"
     5  	"os/exec"
     6  	"strings"
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func Test_genericDumpSchema(t *testing.T) {
    13  	table := []struct {
    14  		cmd *exec.Cmd
    15  		err bool
    16  	}{
    17  		{exec.Command("ls"), false},
    18  		{exec.Command("asdfasdf"), true},
    19  	}
    20  
    21  	for _, tt := range table {
    22  		t.Run(strings.Join(tt.cmd.Args, " "), func(st *testing.T) {
    23  			r := require.New(st)
    24  			bb := &bytes.Buffer{}
    25  			err := genericDumpSchema(&ConnectionDetails{}, tt.cmd, bb)
    26  			if tt.err {
    27  				r.Error(err)
    28  				return
    29  			}
    30  			r.NoError(err)
    31  			r.NotEqual(0, len(bb.Bytes()))
    32  		})
    33  	}
    34  }