Debian Codegraph @

integration/_fixtures/ordered_fixture/ordered_fixture_suite_test.go

raw
1 package ordered_fixture_test
2
3 import (
4 "flag"
5 "testing"
6
7 . "github.com/onsi/ginkgo/v2"
8 . "github.com/onsi/gomega"
9 )
10
11 var noOrdered *bool
12
13 func init() {
14 noOrdered = flag.CommandLine.Bool("no-ordered", false, "set to turn off ordered decoration")
15 }
16
17 var OrderedDecoration = []any{Ordered}
18
19 func TestOrderedFixture(t *testing.T) {
20 RegisterFailHandler(Fail)
21 if *noOrdered {
22 OrderedDecoration = []any{}
23 }
24
25 RunSpecs(t, "OrderedFixture Suite")
26 }
27
28 var _ = Describe("tests", func() {
29 for i := 0; i < 10; i += 1 {
30 Context("ordered", OrderedDecoration, func() {
31 var terribleSharedCounter int
32 var parallelNode int
33
34 BeforeAll(func() {
35 terribleSharedCounter = 1
36 parallelNode = GinkgoParallelProcess()
37 })
38
39 It("increments the counter", func() {
40 Ω(parallelNode).Should(Equal(GinkgoParallelProcess()))
41 terribleSharedCounter++
42 Ω(terribleSharedCounter).Should(Equal(2))
43 })
44
45 It("increments the shared counter", func() {
46 Ω(parallelNode).Should(Equal(GinkgoParallelProcess()))
47 terribleSharedCounter++
48 Ω(terribleSharedCounter).Should(Equal(3))
49 })
50
51 It("increments the terrible shared counter", func() {
52 Ω(parallelNode).Should(Equal(GinkgoParallelProcess()))
53 terribleSharedCounter++
54 Ω(terribleSharedCounter).Should(Equal(4))
55 })
56
57 It("increments the counter again", func() {
58 Ω(parallelNode).Should(Equal(GinkgoParallelProcess()))
59 terribleSharedCounter++
60 Ω(terribleSharedCounter).Should(Equal(5))
61 })
62
63 It("increments the counter and again", func() {
64 Ω(parallelNode).Should(Equal(GinkgoParallelProcess()))
65 terribleSharedCounter++
66 Ω(terribleSharedCounter).Should(Equal(6))
67 })
68
69 AfterAll(func() {
70 Ω(parallelNode).Should(Equal(GinkgoParallelProcess()))
71 Ω(terribleSharedCounter).Should(Equal(6))
72 })
73 })
74 }
75 })