From a101d966133a70b8a76526be25070436d14fcf9f Mon Sep 17 00:00:00 2001 From: Rastislav Szabo Date: Thu, 4 May 2017 11:09:03 +0200 Subject: initial commit Signed-off-by: Rastislav Szabo --- vendor/github.com/onsi/gomega/gexec/build_test.go | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 vendor/github.com/onsi/gomega/gexec/build_test.go (limited to 'vendor/github.com/onsi/gomega/gexec/build_test.go') diff --git a/vendor/github.com/onsi/gomega/gexec/build_test.go b/vendor/github.com/onsi/gomega/gexec/build_test.go new file mode 100644 index 0000000..8df0790 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gexec/build_test.go @@ -0,0 +1,59 @@ +package gexec_test + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var packagePath = "./_fixture/firefly" + +var _ = Describe(".Build", func() { + Context("when there have been previous calls to Build", func() { + BeforeEach(func() { + _, err := gexec.Build(packagePath) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("compiles the specified package", func() { + compiledPath, err := gexec.Build(packagePath) + Ω(err).ShouldNot(HaveOccurred()) + Ω(compiledPath).Should(BeAnExistingFile()) + }) + + Context("and CleanupBuildArtifacts has been called", func() { + BeforeEach(func() { + gexec.CleanupBuildArtifacts() + }) + + It("compiles the specified package", func() { + var err error + fireflyPath, err = gexec.Build(packagePath) + Ω(err).ShouldNot(HaveOccurred()) + Ω(fireflyPath).Should(BeAnExistingFile()) + }) + }) + }) +}) + +var _ = Describe(".BuildWithEnvironment", func() { + var err error + env := []string{ + "GOOS=linux", + "GOARCH=amd64", + } + + It("compiles the specified package with the specified env vars", func() { + compiledPath, err := gexec.BuildWithEnvironment(packagePath, env) + Ω(err).ShouldNot(HaveOccurred()) + Ω(compiledPath).Should(BeAnExistingFile()) + }) + + It("returns the environment to a good state", func() { + _, err = gexec.BuildWithEnvironment(packagePath, env) + Ω(err).ShouldNot(HaveOccurred()) + Ω(os.Environ()).ShouldNot(ContainElement("GOOS=linux")) + }) +}) -- cgit 1.2.3-korg