@@ -13,8 +13,10 @@ func TestDictCompile(t *testing.T) {
13
13
{
14
14
Name : "{KeysValidator:String,ValuesValidator:String}" ,
15
15
Compiler : & schema.Dict {
16
- KeysValidator : & schema.String {},
17
- ValuesValidator : & schema.String {},
16
+ KeysValidator : & schema.String {},
17
+ Values : schema.Field {
18
+ Validator : & schema.String {},
19
+ },
18
20
},
19
21
ReferenceChecker : fakeReferenceChecker {},
20
22
},
@@ -25,19 +27,19 @@ func TestDictCompile(t *testing.T) {
25
27
Error : "invalid regexp: error parsing regexp: missing closing ]: `[invalid re`" ,
26
28
},
27
29
{
28
- Name : "{ValuesValidator :String{Regexp:invalid}}" ,
29
- Compiler : & schema.Dict {ValuesValidator : & schema.String {Regexp : "[invalid re" }},
30
+ Name : "{Values.Validator :String{Regexp:invalid}}" ,
31
+ Compiler : & schema.Dict {Values : schema. Field { Validator : & schema.String {Regexp : "[invalid re" } }},
30
32
ReferenceChecker : fakeReferenceChecker {},
31
33
Error : "invalid regexp: error parsing regexp: missing closing ]: `[invalid re`" ,
32
34
},
33
35
{
34
- Name : "{ValuesValidator :Reference{Path:valid}}" ,
35
- Compiler : & schema.Dict {ValuesValidator : & schema.Reference {Path : "foo" }},
36
+ Name : "{Values.Validator :Reference{Path:valid}}" ,
37
+ Compiler : & schema.Dict {Values : schema. Field { Validator : & schema.Reference {Path : "foo" } }},
36
38
ReferenceChecker : fakeReferenceChecker {"foo" : {}},
37
39
},
38
40
{
39
- Name : "{ValuesValidator :Reference{Path:invalid}}" ,
40
- Compiler : & schema.Dict {ValuesValidator : & schema.Reference {Path : "bar" }},
41
+ Name : "{Values.Validator :Reference{Path:invalid}}" ,
42
+ Compiler : & schema.Dict {Values : schema. Field { Validator : & schema.Reference {Path : "bar" } }},
41
43
ReferenceChecker : fakeReferenceChecker {"foo" : {}},
42
44
Error : "can't find resource 'bar'" ,
43
45
},
@@ -68,20 +70,20 @@ func TestDictValidate(t *testing.T) {
68
70
Error : "invalid key `ba': is shorter than 3" ,
69
71
},
70
72
{
71
- Name : `{ValuesValidator :Bool}.Validate(valid)` ,
72
- Validator : & schema.Dict {ValuesValidator : & schema.Bool {}},
73
+ Name : `{Values.Validator :Bool}.Validate(valid)` ,
74
+ Validator : & schema.Dict {Values : schema. Field { Validator : & schema.Bool {} }},
73
75
Input : map [string ]interface {}{"foo" : true , "bar" : false },
74
76
Expect : map [string ]interface {}{"foo" : true , "bar" : false },
75
77
},
76
78
{
77
- Name : `{ValuesValidator :Bool}.Validate({"foo":true,"bar":"value"})` ,
78
- Validator : & schema.Dict {ValuesValidator : & schema.Bool {}},
79
+ Name : `{Values.Validator :Bool}.Validate({"foo":true,"bar":"value"})` ,
80
+ Validator : & schema.Dict {Values : schema. Field { Validator : & schema.Bool {} }},
79
81
Input : map [string ]interface {}{"foo" : true , "bar" : "value" },
80
82
Error : "invalid value for key `bar': not a Boolean" ,
81
83
},
82
84
{
83
- Name : `{ValuesValidator :String}.Validate("")` ,
84
- Validator : & schema.Dict {ValuesValidator : & schema.String {}},
85
+ Name : `{Values.Validator :String}.Validate("")` ,
86
+ Validator : & schema.Dict {Values : schema. Field { Validator : & schema.String {} }},
85
87
Input : "" ,
86
88
Error : "not a dict" ,
87
89
},
0 commit comments