1package flags_test 2 3import ( 4 "flag" 5 "fmt" 6 remapped "math" 7 _ "math/cmplx" 8 "time" 9 10 . "github.com/onsi/ginkgo" 11 . "github.com/onsi/ginkgo/integration/_fixtures/flags_tests" 12 . "github.com/onsi/gomega" 13) 14 15var customFlag string 16 17func init() { 18 flag.StringVar(&customFlag, "customFlag", "default", "custom flag!") 19} 20 21var _ = Describe("Testing various flags", func() { 22 FDescribe("the focused set", func() { 23 Measure("a measurement", func(b Benchmarker) { 24 b.RecordValue("a value", 3) 25 }, 3) 26 27 It("should honor -cover", func() { 28 Ω(Tested()).Should(Equal("tested")) 29 }) 30 31 It("should allow gcflags", func() { 32 fmt.Printf("NaN returns %T\n", remapped.NaN()) 33 }) 34 35 PIt("should honor -failOnPending and -noisyPendings") 36 37 Describe("smores", func() { 38 It("should honor -skip: marshmallow", func() { 39 println("marshmallow") 40 }) 41 42 It("should honor -focus: chocolate", func() { 43 println("chocolate") 44 }) 45 }) 46 47 It("should detect races", func(done Done) { 48 var a string 49 go func() { 50 a = "now you don't" 51 close(done) 52 }() 53 a = "now you see me" 54 println(a) 55 }) 56 57 It("should randomize A", func() { 58 println("RANDOM_A") 59 }) 60 61 It("should randomize B", func() { 62 println("RANDOM_B") 63 }) 64 65 It("should randomize C", func() { 66 println("RANDOM_C") 67 }) 68 69 It("should honor -slowSpecThreshold", func() { 70 time.Sleep(100 * time.Millisecond) 71 }) 72 73 It("should pass in additional arguments after '--' directly to the test process", func() { 74 fmt.Printf("CUSTOM_FLAG: %s", customFlag) 75 }) 76 }) 77 78 Describe("more smores", func() { 79 It("should not run these unless -focus is set", func() { 80 println("smores") 81 }) 82 }) 83 84 Describe("a failing test", func() { 85 It("should fail", func() { 86 Ω(true).Should(Equal(false)) 87 }) 88 }) 89 90 Describe("a flaky test", func() { 91 runs := 0 92 It("should only pass the second time it's run", func() { 93 runs++ 94 Ω(runs).Should(BeNumerically("==", 2)) 95 }) 96 }) 97}) 98