err = os.MkdirAll(pathB, 0700) Ω(err).ShouldNot(HaveOccurred()) err = os.MkdirAll(pathC, 0700) Ω(err).ShouldNot(HaveOccurred()) copyIn(filepath.Join("watch_fixtures", "A"), pathA) copyIn(filepath.Join("watch_fixtures", "B"), pathB) copyIn(filepath.Join("watch_fixtures", "C"), pathC) }) startGinkgoWithGopath := func(args ...string) *gexec.Session { cmd := ginkgoCommand(rootPath, args...) cmd.Env = append([]string{"GOPATH=" + rootPath + ":" + os.Getenv("GOPATH")}, cmd.Env...) session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter) Ω(err).ShouldNot(HaveOccurred()) return session } modifyFile := func(path string) { time.Sleep(time.Second) content, err := ioutil.ReadFile(path) Ω(err).ShouldNot(HaveOccurred()) content = append(content, []byte("//")...) err = ioutil.WriteFile(path, content, 0666) Ω(err).ShouldNot(HaveOccurred()) } modifyCode := func(pkgToModify string) { modifyFile(filepath.Join(rootPath, "src", "github.com", "onsi", pkgToModify, pkgToModify+".go"))
func startGinkgo(dir string, args ...string) *gexec.Session { cmd := ginkgoCommand(dir, args...) session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter) Ω(err).ShouldNot(HaveOccurred()) return session }