summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_test.go
blob: 27dadf19c81b8c5e21af4a086091e5e0857632cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package flags_test

import (
	"flag"
	"fmt"
	remapped "math"
	_ "math/cmplx"
	"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/ginkgo/integration/_fixtures/flags_tests"
	. "github.com/onsi/gomega"
)

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"))
		})

		It("should allow gcflags", func() {
			fmt.Printf("NaN returns %T\n", remapped.NaN())
		})

		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))
		})
	})

	Describe("a flaky test", func() {
		runs := 0
		It("should only pass the second time it's run", func() {
			runs++
			Ω(runs).Should(BeNumerically("==", 2))
		})
	})
})