File: passing_ginkgo_tests_test.go

package info (click to toggle)
golang-github-onsi-ginkgo-v2 2.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,060 kB
  • sloc: javascript: 59; makefile: 23; sh: 14
file content (47 lines) | stat: -rw-r--r-- 984 bytes parent folder | download | duplicates (2)
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
package passing_ginkgo_tests_test

import (
	"sync"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/ginkgo/v2/integration/_fixtures/passing_ginkgo_tests_fixture"
	. "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))
	})

	Context("when called within goroutines", func() {
		It("does not trigger the race detector", func() {
			wg := &sync.WaitGroup{}
			wg.Add(3)
			for i := 0; i < 3; i += 1 {
				go func() {
					By("avoiding the race detector")
					wg.Done()
				}()
			}
			wg.Wait()
		})
	})

})