| 1 |
package passing_ginkgo_tests_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"sync" |
| 5 |
|
| 6 |
. "github.com/onsi/ginkgo/v2" |
| 7 |
. "github.com/onsi/ginkgo/v2/integration/_fixtures/passing_ginkgo_tests_fixture" |
| 8 |
. "github.com/onsi/gomega" |
| 9 |
) |
| 10 |
|
| 11 |
var _ = Describe("PassingGinkgoTests", func() { |
| 12 |
It("should proxy strings", func() { |
| 13 |
Ω(StringIdentity("foo")).Should(Equal("foo")) |
| 14 |
}) |
| 15 |
|
| 16 |
It("should proxy integers", func() { |
| 17 |
Ω(IntegerIdentity(3)).Should(Equal(3)) |
| 18 |
}) |
| 19 |
|
| 20 |
It("should do it again", func() { |
| 21 |
Ω(StringIdentity("foo")).Should(Equal("foo")) |
| 22 |
Ω(IntegerIdentity(3)).Should(Equal(3)) |
| 23 |
}) |
| 24 |
|
| 25 |
It("should be able to run Bys", func() { |
| 26 |
By("emitting one By") |
| 27 |
Ω(3).Should(Equal(3)) |
| 28 |
|
| 29 |
By("emitting another By") |
| 30 |
Ω(4).Should(Equal(4)) |
| 31 |
}) |
| 32 |
|
| 33 |
Context("when called within goroutines", func() { |
| 34 |
It("does not trigger the race detector", func() { |
| 35 |
wg := &sync.WaitGroup{} |
| 36 |
wg.Add(3) |
| 37 |
for i := 0; i < 3; i += 1 { |
| 38 |
go func() { |
| 39 |
By("avoiding the race detector") |
| 40 |
wg.Done() |
| 41 |
}() |
| 42 |
} |
| 43 |
wg.Wait() |
| 44 |
}) |
| 45 |
}) |
| 46 |
|
| 47 |
}) |