github.com/ianfoo/lab@v0.9.5-0.20180123060006-5ed79f2ccfc7/cmd/snippetList_test.go (about) 1 package cmd 2 3 import ( 4 "os/exec" 5 "strings" 6 "testing" 7 8 "github.com/stretchr/testify/require" 9 ) 10 11 // Test for listing personal snippets in snippet_test.go 12 13 func Test_snippetList(t *testing.T) { 14 t.Parallel() 15 repo := copyTestRepo(t) 16 cmd := exec.Command("../lab_bin", "snippet", "list", "lab-testing") 17 cmd.Dir = repo 18 19 b, err := cmd.CombinedOutput() 20 if err != nil { 21 t.Log(string(b)) 22 t.Fatal(err) 23 } 24 25 snips := strings.Split(string(b), "\n") 26 t.Log(snips) 27 require.Regexp(t, `#\d+ snippet title`, snips[0]) 28 }