Skip to content

Commit 539c398

Browse files
author
jchadwick-buf
authored
Update tests to adhere to CEL formatting standard (#345)
This updates our test suite to follow the expectations set here: https://github.com/google/cel-spec/blob/master/doc/extensions/strings.md Related: google/cel-go#1133
1 parent 3bc02d0 commit 539c398

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

tools/protovalidate-conformance/internal/cases/cases_duration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func durationSuite() suites.Suite {
9393
Field: results.FieldPath("val"),
9494
Rule: results.FieldPath("duration.in"),
9595
ConstraintId: proto.String("duration.in"),
96-
Message: proto.String(`value must be in list [duration("1s"), duration("0.000001s")]`),
96+
Message: proto.String(`value must be in list [1s, 0.000001s]`),
9797
}),
9898
},
9999
"not in/valid": {
@@ -115,7 +115,7 @@ func durationSuite() suites.Suite {
115115
Field: results.FieldPath("val"),
116116
Rule: results.FieldPath("duration.not_in"),
117117
ConstraintId: proto.String("duration.not_in"),
118-
Message: proto.String(`value must not be in list [duration("0s")]`),
118+
Message: proto.String(`value must not be in list [0s]`),
119119
}),
120120
},
121121
"lt/valid": {

tools/protovalidate-conformance/internal/cases/cases_kitchensink.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func kitchenSinkSuite() suites.Suite {
4949
Field: results.FieldPath("val.double_in"),
5050
Rule: results.FieldPath("double.in"),
5151
ConstraintId: proto.String("double.in"),
52-
Message: proto.String("value must be in list [456.789000, 123.000000]"),
52+
Message: proto.String("value must be in list [456.789, 123]"),
5353
},
5454
&validate.Violation{
5555
Field: results.FieldPath("val.enum_const"),
@@ -101,13 +101,13 @@ func kitchenSinkSuite() suites.Suite {
101101
Field: results.FieldPath("val.another.double_in"),
102102
Rule: results.FieldPath("double.in"),
103103
ConstraintId: proto.String("double.in"),
104-
Message: proto.String("value must be in list [456.789000, 123.000000]"),
104+
Message: proto.String("value must be in list [456.789, 123]"),
105105
},
106106
&validate.Violation{
107107
Field: results.FieldPath("val.double_in"),
108108
Rule: results.FieldPath("double.in"),
109109
ConstraintId: proto.String("double.in"),
110-
Message: proto.String("value must be in list [456.789000, 123.000000]"),
110+
Message: proto.String("value must be in list [456.789, 123]"),
111111
},
112112
&validate.Violation{
113113
Field: results.FieldPath("val.another.enum_const"),
@@ -194,13 +194,13 @@ func kitchenSinkSuite() suites.Suite {
194194
Field: results.FieldPath("val.double_in"),
195195
Rule: results.FieldPath("double.in"),
196196
ConstraintId: proto.String("double.in"),
197-
Message: proto.String("value must be in list [456.789000, 123.000000]"),
197+
Message: proto.String("value must be in list [456.789, 123]"),
198198
},
199199
&validate.Violation{
200200
Field: results.FieldPath("val.nested.double_in"),
201201
Rule: results.FieldPath("double.in"),
202202
ConstraintId: proto.String("double.in"),
203-
Message: proto.String("value must be in list [456.789000, 123.000000]"),
203+
Message: proto.String("value must be in list [456.789, 123]"),
204204
},
205205
&validate.Violation{
206206
Field: results.FieldPath("val.enum_const"),
@@ -281,7 +281,7 @@ func kitchenSinkSuite() suites.Suite {
281281
Field: results.FieldPath("val.double_in"),
282282
Rule: results.FieldPath("double.in"),
283283
ConstraintId: proto.String("double.in"),
284-
Message: proto.String("value must be in list [456.789000, 123.000000]"),
284+
Message: proto.String("value must be in list [456.789, 123]"),
285285
},
286286
&validate.Violation{
287287
Field: results.FieldPath("val.enum_const"),

tools/protovalidate-conformance/internal/cases/cases_repeated.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func repeatedSuite() suites.Suite {
273273
Field: results.FieldPath("val[0]"),
274274
Rule: results.FieldPath("repeated.items.string.in"),
275275
ConstraintId: proto.String("string.in"),
276-
Message: proto.String(`value must be in list ["foo", "bar"]`),
276+
Message: proto.String(`value must be in list [foo, bar]`),
277277
},
278278
),
279279
},
@@ -288,7 +288,7 @@ func repeatedSuite() suites.Suite {
288288
Field: results.FieldPath("val[0]"),
289289
Rule: results.FieldPath("repeated.items.string.not_in"),
290290
ConstraintId: proto.String("string.not_in"),
291-
Message: proto.String("value must not be in list [\"foo\", \"bar\"]"),
291+
Message: proto.String("value must not be in list [foo, bar]"),
292292
},
293293
),
294294
},

0 commit comments

Comments
 (0)