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 e867a77ca895f2f6e81a97c2e76e5bb86b7df6e3..8f52a14d70c2e021ca7763fc7ada029882651bb9 100644
--- a/cuesonnet_test.go
+++ b/cuesonnet_test.go
@@ -11,6 +11,8 @@
var (
//go:embed testdata/schema.cue
schema cuesonnet.Schema
+ //go:embed testdata/schema_list.cue
+ schemaList cuesonnet.Schema
//go:embed testdata/config.jsonnet
config string
//go:embed testdata/almost-fixed.jsonnet
@@ -19,6 +21,8 @@ //go:embed testdata/fixed.jsonnet
fixed string
//go:embed testdata/kitchen.jsonnet
kitchen string
+ //go:embed testdata/kitchen_list.jsonnet
+ kitchenList string
)
type Schema struct {
@@ -48,7 +52,7 @@ var s Schema
err := schema.Decode(strings.NewReader(almostFixed), &s)
for _, s := range []string{"1", "LastName"} {
if !strings.Contains(err.Error(), s) {
- t.Logf("did not find %q in error", s)
+ t.Logf("did not find %q in error: %q", s, err)
t.Fail()
}
}
@@ -81,6 +85,19 @@ 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)
+ t.Fail()
+ }
+ })
+
+ t.Run("list", func(t *testing.T) {
+ t.Parallel()
+ var s []Schema
+ if err := schemaList.Decode(strings.NewReader(kitchenList), &s); err != nil {
+ t.Logf("kitchen_list config should not fail to decode: %v", err)
+ t.Fail()
+ }
+ if s[0] != expect {
t.Logf("did not get expected decoding: %+v != %+v", s, expect)
t.Fail()
}
|