Use Go 1.5 vendoring instead of Godeps

Change made by:

- running "gvt fetch" on each of the packages mentioned in
  Godeps/Godeps.json
- `rm -rf Godeps`
- tweaking the build scripts to not mention Godeps
- tweaking the build scripts to test `./lib/...`, `./cmd/...` explicitly
  (to avoid testing vendor)
- tweaking the build scripts to not juggle GOPATH for Godeps and instead
  set GO15VENDOREXPERIMENT.

This also results in some updated packages at the same time I bet.

Building with Go 1.3 and 1.4 still *works* but won't use our vendored
dependencies - the user needs to have the actual packages in their
GOPATH then, which they'll get with a normal "go get". Building with Go
1.6+ will get our vendored dependencies by default even when not using
our build script, which is nice.

By doing this we gain some freedom in that we can pick and choose
manually what to include in vendor, as it's not based on just dependency
analysis of our own code. This is also a risk as we might pick up
dependencies we are unaware of, as the build may work locally with those
packages present in GOPATH. On the other hand the build server will
detect this as it has no packages in it's GOPATH beyond what is included
in the repo.

Recommended tool to manage dependencies is github.com/FiloSottile/gvt.
This commit is contained in:
Jakob Borg
2016-03-05 21:01:58 +01:00
parent 9259425a9a
commit 65aaa607ab
694 changed files with 65763 additions and 3541 deletions
@@ -0,0 +1,14 @@
package tmp
import (
"testing"
)
func TestSomethingLessImportant(t *testing.T) {
strp := "hello!"
somethingImportant(t, &strp)
}
func somethingImportant(t *testing.T, message *string) {
t.Log("Something important happened in a test: " + *message)
}
@@ -0,0 +1,10 @@
package nested
import (
"testing"
)
func TestSomethingLessImportant(t *testing.T) {
whatever := &UselessStruct{}
t.Fail(whatever.ImportantField != "SECRET_PASSWORD")
}
@@ -0,0 +1,9 @@
package subpackage
import (
"testing"
)
func TestNestedSubPackages(t *testing.T) {
t.Fail(true)
}
@@ -0,0 +1,16 @@
package tmp_test
import (
"testing"
)
type UselessStruct struct {
ImportantField string
}
func TestSomethingImportant(t *testing.T) {
whatever := &UselessStruct{}
if whatever.ImportantField != "SECRET_PASSWORD" {
t.Fail()
}
}
@@ -0,0 +1,41 @@
package tmp
import (
"testing"
)
type UselessStruct struct {
ImportantField string
T *testing.T
}
var testFunc = func(t *testing.T, arg *string) {}
func assertEqual(t *testing.T, arg1, arg2 interface{}) {
if arg1 != arg2 {
t.Fail()
}
}
func TestSomethingImportant(t *testing.T) {
whatever := &UselessStruct{
T: t,
ImportantField: "SECRET_PASSWORD",
}
something := &UselessStruct{ImportantField: "string value"}
assertEqual(t, whatever.ImportantField, "SECRET_PASSWORD")
assertEqual(t, something.ImportantField, "string value")
var foo = func(t *testing.T) {}
foo(t)
strp := "something"
testFunc(t, &strp)
t.Fail()
}
func Test3Things(t *testing.T) {
if 3 != 3 {
t.Fail()
}
}
@@ -0,0 +1,17 @@
package tmp
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("Testing with Ginkgo", func() {
It("something less important", func() {
strp := "hello!"
somethingImportant(GinkgoT(), &strp)
})
})
func somethingImportant(t GinkgoTInterface, message *string) {
t.Log("Something important happened in a test: " + *message)
}
@@ -0,0 +1,13 @@
package tmp
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestTmp(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Tmp Suite")
}
@@ -0,0 +1,11 @@
package subpackage
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("Testing with Ginkgo", func() {
It("nested sub packages", func() {
GinkgoT().Fail(true)
})
})
@@ -0,0 +1,13 @@
package nested_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestNested(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Nested Suite")
}
@@ -0,0 +1,13 @@
package nested
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("Testing with Ginkgo", func() {
It("something less important", func() {
whatever := &UselessStruct{}
GinkgoT().Fail(whatever.ImportantField != "SECRET_PASSWORD")
})
})
@@ -0,0 +1,19 @@
package tmp_test
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("Testing with Ginkgo", func() {
It("something important", func() {
whatever := &UselessStruct{}
if whatever.ImportantField != "SECRET_PASSWORD" {
GinkgoT().Fail()
}
})
})
type UselessStruct struct {
ImportantField string
}
@@ -0,0 +1,13 @@
package tmp_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestConvertFixtures(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "ConvertFixtures Suite")
}
@@ -0,0 +1,44 @@
package tmp
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("Testing with Ginkgo", func() {
It("something important", func() {
whatever := &UselessStruct{
T: GinkgoT(),
ImportantField: "SECRET_PASSWORD",
}
something := &UselessStruct{ImportantField: "string value"}
assertEqual(GinkgoT(), whatever.ImportantField, "SECRET_PASSWORD")
assertEqual(GinkgoT(), something.ImportantField, "string value")
var foo = func(t GinkgoTInterface) {}
foo(GinkgoT())
strp := "something"
testFunc(GinkgoT(), &strp)
GinkgoT().Fail()
})
It("3 things", func() {
if 3 != 3 {
GinkgoT().Fail()
}
})
})
type UselessStruct struct {
ImportantField string
T GinkgoTInterface
}
var testFunc = func(t GinkgoTInterface, arg *string) {}
func assertEqual(t GinkgoTInterface, arg1, arg2 interface{}) {
if arg1 != arg2 {
t.Fail()
}
}
@@ -0,0 +1,21 @@
package coverage_fixture
func A() string {
return "A"
}
func B() string {
return "B"
}
func C() string {
return "C"
}
func D() string {
return "D"
}
func E() string {
return "untested"
}
@@ -0,0 +1,13 @@
package coverage_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestCoverageFixture(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "CoverageFixture Suite")
}
@@ -0,0 +1,31 @@
package coverage_fixture_test
import (
. "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture"
. "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CoverageFixture", func() {
It("should test A", func() {
Ω(A()).Should(Equal("A"))
})
It("should test B", func() {
Ω(B()).Should(Equal("B"))
})
It("should test C", func() {
Ω(C()).Should(Equal("C"))
})
It("should test D", func() {
Ω(D()).Should(Equal("D"))
})
It("should test external package", func() {
Ω(Tested()).Should(Equal("tested"))
})
})
@@ -0,0 +1,9 @@
package external_coverage
func Tested() string {
return "tested"
}
func Untested() string {
return "untested"
}
@@ -0,0 +1,13 @@
package does_not_compile_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestDoes_not_compile(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Does_not_compile Suite")
}
@@ -0,0 +1,11 @@
package does_not_compile_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/integration/_fixtures/does_not_compile"
. "github.com/onsi/gomega"
)
var _ = Describe("DoesNotCompile", func() {
})
@@ -0,0 +1,13 @@
package eventually_failing_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestEventuallyFailing(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "EventuallyFailing Suite")
}
@@ -0,0 +1,29 @@
package eventually_failing_test
import (
"fmt"
"io/ioutil"
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("EventuallyFailing", func() {
It("should fail on the third try", func() {
time.Sleep(time.Second)
files, err := ioutil.ReadDir(".")
Ω(err).ShouldNot(HaveOccurred())
numRuns := 1
for _, file := range files {
if strings.HasPrefix(file.Name(), "counter") {
numRuns++
}
}
Ω(numRuns).Should(BeNumerically("<", 3))
ioutil.WriteFile(fmt.Sprintf("./counter-%d", numRuns), []byte("foo"), 0777)
})
})
@@ -0,0 +1,35 @@
package synchronized_setup_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"fmt"
"os"
"testing"
)
func TestSynchronized_setup_tests(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Synchronized_setup_tests Suite")
}
var beforeData string
var _ = SynchronizedBeforeSuite(func() []byte {
fmt.Printf("BEFORE_A_%d\n", GinkgoParallelNode())
os.Exit(1)
return []byte("WHAT EVZ")
}, func(data []byte) {
println("NEVER SEE THIS")
})
var _ = Describe("Synchronized Setup", func() {
It("should do nothing", func() {
Ω(true).Should(BeTrue())
})
It("should do nothing", func() {
Ω(true).Should(BeTrue())
})
})
@@ -0,0 +1,13 @@
package fail_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFail_fixture(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Fail_fixture Suite")
}
@@ -0,0 +1,99 @@
package fail_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = It("handles top level failures", func() {
Ω("a top level failure on line 9").Should(Equal("nope"))
println("NEVER SEE THIS")
})
var _ = It("handles async top level failures", func(done Done) {
Fail("an async top level failure on line 14")
println("NEVER SEE THIS")
}, 0.1)
var _ = It("FAIL in a goroutine", func(done Done) {
go func() {
defer GinkgoRecover()
Fail("a top level goroutine failure on line 21")
println("NEVER SEE THIS")
}()
}, 0.1)
var _ = Describe("Excercising different failure modes", func() {
It("synchronous failures", func() {
Ω("a sync failure").Should(Equal("nope"))
println("NEVER SEE THIS")
})
It("synchronous panics", func() {
panic("a sync panic")
println("NEVER SEE THIS")
})
It("synchronous failures with FAIL", func() {
Fail("a sync FAIL failure")
println("NEVER SEE THIS")
})
It("async timeout", func(done Done) {
Ω(true).Should(BeTrue())
}, 0.1)
It("async failure", func(done Done) {
Ω("an async failure").Should(Equal("nope"))
println("NEVER SEE THIS")
}, 0.1)
It("async panic", func(done Done) {
panic("an async panic")
println("NEVER SEE THIS")
}, 0.1)
It("async failure with FAIL", func(done Done) {
Fail("an async FAIL failure")
println("NEVER SEE THIS")
}, 0.1)
It("FAIL in a goroutine", func(done Done) {
go func() {
defer GinkgoRecover()
Fail("a goroutine FAIL failure")
println("NEVER SEE THIS")
}()
}, 0.1)
It("Gomega in a goroutine", func(done Done) {
go func() {
defer GinkgoRecover()
Ω("a goroutine failure").Should(Equal("nope"))
println("NEVER SEE THIS")
}()
}, 0.1)
It("Panic in a goroutine", func(done Done) {
go func() {
defer GinkgoRecover()
panic("a goroutine panic")
println("NEVER SEE THIS")
}()
}, 0.1)
Measure("a FAIL measure", func(Benchmarker) {
Fail("a measure FAIL failure")
println("NEVER SEE THIS")
}, 1)
Measure("a gomega failed measure", func(Benchmarker) {
Ω("a measure failure").Should(Equal("nope"))
println("NEVER SEE THIS")
}, 1)
Measure("a panicking measure", func(Benchmarker) {
panic("a measure panic")
println("NEVER SEE THIS")
}, 1)
})
@@ -0,0 +1,22 @@
package failing_before_suite_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFailingAfterSuite(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "FailingAfterSuite Suite")
}
var _ = BeforeSuite(func() {
println("BEFORE SUITE")
})
var _ = AfterSuite(func() {
println("AFTER SUITE")
panic("BAM!")
})
@@ -0,0 +1,15 @@
package failing_before_suite_test
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("FailingBeforeSuite", func() {
It("should run", func() {
println("A TEST")
})
It("should run", func() {
println("A TEST")
})
})
@@ -0,0 +1,22 @@
package failing_before_suite_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFailing_before_suite(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Failing_before_suite Suite")
}
var _ = BeforeSuite(func() {
println("BEFORE SUITE")
panic("BAM!")
})
var _ = AfterSuite(func() {
println("AFTER SUITE")
})
@@ -0,0 +1,15 @@
package failing_before_suite_test
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("FailingBeforeSuite", func() {
It("should never run", func() {
println("NEVER SEE THIS")
})
It("should never run", func() {
println("NEVER SEE THIS")
})
})
@@ -0,0 +1,5 @@
package failing_ginkgo_tests
func AlwaysFalse() bool {
return false
}
@@ -0,0 +1,13 @@
package failing_ginkgo_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFailing_ginkgo_tests(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Failing_ginkgo_tests Suite")
}
@@ -0,0 +1,17 @@
package failing_ginkgo_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests"
. "github.com/onsi/gomega"
)
var _ = Describe("FailingGinkgoTests", func() {
It("should fail", func() {
Ω(AlwaysFalse()).Should(BeTrue())
})
It("should pass", func() {
Ω(AlwaysFalse()).Should(BeFalse())
})
})
@@ -0,0 +1,9 @@
package flags
func Tested() string {
return "tested"
}
func Untested() string {
return "untested"
}
@@ -0,0 +1,13 @@
package flags_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFlags(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Flags Suite")
}
@@ -0,0 +1,82 @@
package flags_test
import (
"flag"
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/integration/_fixtures/flags_tests"
. "github.com/onsi/gomega"
"time"
)
var customFlag string
func init() {
flag.StringVar(&customFlag, "customFlag", "default", "custom flag!")
}
var _ = Describe("Testing various flags", func() {
FDescribe("the focused set", func() {
Measure("a measurement", func(b Benchmarker) {
b.RecordValue("a value", 3)
}, 3)
It("should honor -cover", func() {
Ω(Tested()).Should(Equal("tested"))
})
PIt("should honor -failOnPending and -noisyPendings")
Describe("smores", func() {
It("should honor -skip: marshmallow", func() {
println("marshmallow")
})
It("should honor -focus: chocolate", func() {
println("chocolate")
})
})
It("should detect races", func(done Done) {
var a string
go func() {
a = "now you don't"
close(done)
}()
a = "now you see me"
println(a)
})
It("should randomize A", func() {
println("RANDOM_A")
})
It("should randomize B", func() {
println("RANDOM_B")
})
It("should randomize C", func() {
println("RANDOM_C")
})
It("should honor -slowSpecThreshold", func() {
time.Sleep(100 * time.Millisecond)
})
It("should pass in additional arguments after '--' directly to the test process", func() {
fmt.Printf("CUSTOM_FLAG: %s", customFlag)
})
})
Describe("more smores", func() {
It("should not run these unless -focus is set", func() {
println("smores")
})
})
Describe("a failing test", func() {
It("should fail", func() {
Ω(true).Should(Equal(false))
})
})
})
@@ -0,0 +1,13 @@
package focused_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFocused_fixture(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Focused_fixture Suite")
}
@@ -0,0 +1,63 @@
package focused_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
)
var _ = Describe("FocusedFixture", func() {
FDescribe("focused", func() {
It("focused", func() {
})
})
FContext("focused", func() {
It("focused", func() {
})
})
FIt("focused", func() {
})
FMeasure("focused", func(b Benchmarker) {
}, 2)
FDescribeTable("focused",
func() {},
Entry("focused"),
)
DescribeTable("focused",
func() {},
FEntry("focused"),
)
Describe("not focused", func() {
It("not focused", func() {
})
})
Context("not focused", func() {
It("not focused", func() {
})
})
It("not focused", func() {
})
Measure("not focused", func(b Benchmarker) {
}, 2)
DescribeTable("not focused",
func() {},
Entry("not focused"),
)
})
@@ -0,0 +1,13 @@
package hanging_suite_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestHangingSuite(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "HangingSuite Suite")
}
@@ -0,0 +1,30 @@
package hanging_suite_test
import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
)
var _ = AfterSuite(func() {
fmt.Println("Heading Out After Suite")
})
var _ = Describe("HangingSuite", func() {
BeforeEach(func() {
fmt.Fprintln(GinkgoWriter, "Just beginning")
})
Context("inner context", func() {
BeforeEach(func() {
fmt.Fprintln(GinkgoWriter, "Almost there...")
})
It("should hang out for a while", func() {
fmt.Fprintln(GinkgoWriter, "Hanging Out")
fmt.Println("Sleeping...")
time.Sleep(time.Hour)
})
})
})
@@ -0,0 +1,5 @@
package more_ginkgo_tests
func AlwaysTrue() bool {
return true
}
@@ -0,0 +1,13 @@
package more_ginkgo_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestMore_ginkgo_tests(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "More_ginkgo_tests Suite")
}
@@ -0,0 +1,17 @@
package more_ginkgo_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests"
. "github.com/onsi/gomega"
)
var _ = Describe("MoreGinkgoTests", func() {
It("should pass", func() {
Ω(AlwaysTrue()).Should(BeTrue())
})
It("should always pass", func() {
Ω(AlwaysTrue()).Should(BeTrue())
})
})
@@ -0,0 +1,4 @@
package main
func main() {
}
@@ -0,0 +1,9 @@
package passing_ginkgo_tests
func StringIdentity(a string) string {
return a
}
func IntegerIdentity(a int) int {
return a
}
@@ -0,0 +1,13 @@
package passing_ginkgo_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestPassing_ginkgo_tests(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Passing_ginkgo_tests Suite")
}
@@ -0,0 +1,30 @@
package passing_ginkgo_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests"
. "github.com/onsi/gomega"
)
var _ = Describe("PassingGinkgoTests", func() {
It("should proxy strings", func() {
Ω(StringIdentity("foo")).Should(Equal("foo"))
})
It("should proxy integers", func() {
Ω(IntegerIdentity(3)).Should(Equal(3))
})
It("should do it again", func() {
Ω(StringIdentity("foo")).Should(Equal("foo"))
Ω(IntegerIdentity(3)).Should(Equal(3))
})
It("should be able to run Bys", func() {
By("emitting one By")
Ω(3).Should(Equal(3))
By("emitting another By")
Ω(4).Should(Equal(4))
})
})
@@ -0,0 +1,26 @@
package passing_before_suite_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestPassingSuiteSetup(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "PassingSuiteSetup Suite")
}
var a string
var b string
var _ = BeforeSuite(func() {
a = "ran before suite"
println("BEFORE SUITE")
})
var _ = AfterSuite(func() {
b = "ran after suite"
println("AFTER SUITE")
})
@@ -0,0 +1,28 @@
package passing_before_suite_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("PassingSuiteSetup", func() {
It("should pass", func() {
Ω(a).Should(Equal("ran before suite"))
Ω(b).Should(BeEmpty())
})
It("should pass", func() {
Ω(a).Should(Equal("ran before suite"))
Ω(b).Should(BeEmpty())
})
It("should pass", func() {
Ω(a).Should(Equal("ran before suite"))
Ω(b).Should(BeEmpty())
})
It("should pass", func() {
Ω(a).Should(Equal("ran before suite"))
Ω(b).Should(BeEmpty())
})
})
@@ -0,0 +1,13 @@
package progress_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestProgressFixture(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "ProgressFixture Suite")
}
@@ -0,0 +1,39 @@
package progress_fixture_test
import (
"fmt"
. "github.com/onsi/ginkgo"
)
var _ = Describe("ProgressFixture", func() {
BeforeEach(func() {
fmt.Fprintln(GinkgoWriter, ">outer before<")
})
JustBeforeEach(func() {
fmt.Fprintln(GinkgoWriter, ">outer just before<")
})
AfterEach(func() {
fmt.Fprintln(GinkgoWriter, ">outer after<")
})
Context("Inner Context", func() {
BeforeEach(func() {
fmt.Fprintln(GinkgoWriter, ">inner before<")
})
JustBeforeEach(func() {
fmt.Fprintln(GinkgoWriter, ">inner just before<")
})
AfterEach(func() {
fmt.Fprintln(GinkgoWriter, ">inner after<")
})
It("should emit progress as it goes", func() {
fmt.Fprintln(GinkgoWriter, ">it<")
})
})
})
@@ -0,0 +1,13 @@
package fail_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestFail_fixture(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Skip_fixture Suite")
}
@@ -0,0 +1,71 @@
package fail_fixture_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = It("handles top level skips", func() {
Skip("a top level skip on line 9")
println("NEVER SEE THIS")
})
var _ = It("handles async top level skips", func(done Done) {
Skip("an async top level skip on line 14")
println("NEVER SEE THIS")
}, 0.1)
var _ = It("SKIP in a goroutine", func(done Done) {
go func() {
defer GinkgoRecover()
Skip("a top level goroutine skip on line 21")
println("NEVER SEE THIS")
}()
}, 0.1)
var _ = Describe("Excercising different skip modes", func() {
It("synchronous skip", func() {
Skip("a sync SKIP")
println("NEVER SEE THIS")
})
It("async skip", func(done Done) {
Skip("an async SKIP")
println("NEVER SEE THIS")
}, 0.1)
It("SKIP in a goroutine", func(done Done) {
go func() {
defer GinkgoRecover()
Skip("a goroutine SKIP")
println("NEVER SEE THIS")
}()
}, 0.1)
Measure("a SKIP measure", func(Benchmarker) {
Skip("a measure SKIP")
println("NEVER SEE THIS")
}, 1)
})
var _ = Describe("SKIP in a BeforeEach", func() {
BeforeEach(func() {
Skip("a BeforeEach SKIP")
println("NEVER SEE THIS")
})
It("a SKIP BeforeEach", func() {
println("NEVER SEE THIS")
})
})
var _ = Describe("SKIP in an AfterEach", func() {
AfterEach(func() {
Skip("an AfterEach SKIP")
println("NEVER SEE THIS")
})
It("a SKIP AfterEach", func() {
Expect(true).To(BeTrue())
})
})
@@ -0,0 +1,9 @@
package suite_command
func Tested() string {
return "tested"
}
func Untested() string {
return "untested"
}
@@ -0,0 +1,13 @@
package suite_command_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestSuiteCommand(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Suite Command Suite")
}
@@ -0,0 +1,18 @@
package suite_command_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Testing suite command", func() {
It("it should succeed", func() {
Ω(true).Should(Equal(true))
})
PIt("a failing test", func() {
It("should fail", func() {
Ω(true).Should(Equal(false))
})
})
})
@@ -0,0 +1,43 @@
package synchronized_setup_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"fmt"
"testing"
"time"
)
func TestSynchronized_setup_tests(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Synchronized_setup_tests Suite")
}
var beforeData string
var _ = SynchronizedBeforeSuite(func() []byte {
fmt.Printf("BEFORE_A_%d\n", GinkgoParallelNode())
time.Sleep(100 * time.Millisecond)
return []byte("DATA")
}, func(data []byte) {
fmt.Printf("BEFORE_B_%d: %s\n", GinkgoParallelNode(), string(data))
beforeData += string(data) + "OTHER"
})
var _ = SynchronizedAfterSuite(func() {
fmt.Printf("\nAFTER_A_%d\n", GinkgoParallelNode())
time.Sleep(100 * time.Millisecond)
}, func() {
fmt.Printf("AFTER_B_%d\n", GinkgoParallelNode())
})
var _ = Describe("Synchronized Setup", func() {
It("should run the before suite once", func() {
Ω(beforeData).Should(Equal("DATAOTHER"))
})
It("should run the before suite once", func() {
Ω(beforeData).Should(Equal("DATAOTHER"))
})
})
@@ -0,0 +1,17 @@
// +build complex_tests
package tags_tests_test
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("Ignored", func() {
It("should not have these tests", func() {
})
It("should not have these tests", func() {
})
})
@@ -0,0 +1,13 @@
package tags_tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestTagsTests(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "TagsTests Suite")
}
@@ -0,0 +1,11 @@
package tags_tests_test
import (
. "github.com/onsi/ginkgo"
)
var _ = Describe("TagsTests", func() {
It("should have a test", func() {
})
})
@@ -0,0 +1,13 @@
package test_description_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestTestDescription(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "TestDescription Suite")
}
@@ -0,0 +1,23 @@
package test_description_test
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("TestDescription", func() {
It("should pass", func() {
Ω(true).Should(BeTrue())
})
It("should fail", func() {
Ω(true).Should(BeFalse())
})
AfterEach(func() {
description := CurrentGinkgoTestDescription()
fmt.Printf("%s:%t\n", description.FullTestText, description.Failed)
})
})
@@ -0,0 +1,7 @@
package A
import "github.com/onsi/B"
func DoIt() string {
return B.DoIt()
}
@@ -0,0 +1,13 @@
package A_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestA(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "A Suite")
}
@@ -0,0 +1,14 @@
package A_test
import (
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("A", func() {
It("should do it", func() {
Ω(DoIt()).Should(Equal("done!"))
})
})
@@ -0,0 +1,7 @@
package B
import "github.com/onsi/C"
func DoIt() string {
return C.DoIt()
}
@@ -0,0 +1,13 @@
package B_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestB(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "B Suite")
}
@@ -0,0 +1,14 @@
package B_test
import (
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("B", func() {
It("should do it", func() {
Ω(DoIt()).Should(Equal("done!"))
})
})
@@ -0,0 +1,5 @@
package C
func DoIt() string {
return "done!"
}
@@ -0,0 +1,13 @@
package C_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestC(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "C Suite")
}
@@ -0,0 +1,14 @@
package C_test
import (
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("C", func() {
It("should do it", func() {
Ω(DoIt()).Should(Equal("done!"))
})
})
@@ -0,0 +1,7 @@
package D
import "github.com/onsi/C"
func DoIt() string {
return C.DoIt()
}
@@ -0,0 +1,13 @@
package D_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestD(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "D Suite")
}
@@ -0,0 +1,14 @@
package D_test
import (
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("D", func() {
It("should do it", func() {
Ω(DoIt()).Should(Equal("done!"))
})
})
@@ -0,0 +1,5 @@
package xunit_tests
func AlwaysTrue() bool {
return true
}
@@ -0,0 +1,11 @@
package xunit_tests
import (
"testing"
)
func TestAlwaysTrue(t *testing.T) {
if AlwaysTrue() != true {
t.Errorf("Expected true, got false")
}
}