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
48
49
50
51
|
diff --git a/cuesonnet_test.go b/cuesonnet_test.go
index f645e5e0a14a69db43e7c6781c905d5a6c22d0c2..e867a77ca895f2f6e81a97c2e76e5bb86b7df6e3 100644
--- a/cuesonnet_test.go
+++ b/cuesonnet_test.go
@@ -17,6 +17,8 @@ //go:embed testdata/almost-fixed.jsonnet
almostFixed string
//go:embed testdata/fixed.jsonnet
fixed string
+ //go:embed testdata/kitchen.jsonnet
+ kitchen string
)
type Schema struct {
@@ -52,6 +54,13 @@ }
}
})
+ expect := Schema{
+ FirstName: "Jim",
+ LastName: "Jimbly",
+ Age: 45,
+ Birthday: "01/02/2003",
+ Gopher: true,
+ }
t.Run("fixed", func(t *testing.T) {
t.Parallel()
var s Schema
@@ -59,12 +68,17 @@ if err := schema.Decode(strings.NewReader(fixed), &s); err != nil {
t.Logf("fixed config should not fail to decode: %v", err)
t.Fail()
}
- expect := Schema{
- FirstName: "Jim",
- LastName: "Jimbly",
- Age: 45,
- Birthday: "01/02/2003",
- Gopher: true,
+ if s != expect {
+ t.Logf("did not get expected decoding: %+v != %+v", s, expect)
+ t.Fail()
+ }
+ })
+ t.Run("kitchen", func(t *testing.T) {
+ t.Parallel()
+ var s Schema
+ if err := schema.Decode(strings.NewReader(kitchen), &s); err != nil {
+ t.Logf("kitchen config should not fail to decode: %v", err)
+ t.Fail()
}
if s != expect {
t.Logf("did not get expected decoding: %+v != %+v", s, expect)
|