github.com/zaquestion/lab@v0.25.1/cmd/clone_test.go (about) 1 package cmd 2 3 import ( 4 "os/exec" 5 "regexp" 6 "testing" 7 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func Test_clone(t *testing.T) { 12 t.Parallel() 13 repo := copyTestRepo(t) 14 cmd := exec.Command(labBinaryPath, "clone", "test") 15 cmd.Dir = repo 16 17 b, err := cmd.CombinedOutput() 18 if err != nil { 19 t.Log(string(b)) 20 t.Fatal(err) 21 } 22 out := string(b) 23 t.Log(out) 24 25 assert.Contains(t, out, "Cloning into 'test'...") 26 assert.Regexp(t, regexp.MustCompile(` \* \[new branch\]\s+master\s+-> upstream/master`), out) 27 assert.Contains(t, out, "new remote: upstream") 28 }