-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain_test.go
40 lines (33 loc) · 832 Bytes
/
main_test.go
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
package main
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/tommy351/goldga"
)
func Test(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "examples")
}
var _ = Describe("Examples", func() {
It("string", func() {
Expect("abc").To(goldga.Match())
})
It("bool", func() {
Expect(true).To(goldga.Match())
})
It("map", func() {
Expect(map[string]interface{}{
"a": "str",
"b": true,
"c": 123,
"d": 3.14,
"e": []string{"a", "b", "c"},
}).To(goldga.Match())
})
It("multiple gold files in the same test", func() {
Expect("foo").To(goldga.Match(goldga.WithDescription("first gold file")))
Expect("bar").To(goldga.Match(goldga.WithDescription("second gold file")))
Expect("foobar").To(goldga.Match(goldga.WithDescription("third gold file")))
})
})