Skip to content

Commit 933fe0b

Browse files
joeybloggsjoeybloggs
authored andcommitted
Add test for comma and pipe obfuscation
1 parent e005b06 commit 933fe0b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

validator_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@ func AssertError(t *testing.T, errs ValidationErrors, key, field, expectedTag st
229229
EqualSkip(t, 2, val.Tag, expectedTag)
230230
}
231231

232+
func TestCommaAndPipeObfuscationValidation(t *testing.T) {
233+
s := "My Name Is, |joeybloggs|"
234+
235+
errs := validate.Field(s, "excludesall=0x2C")
236+
NotEqual(t, errs, nil)
237+
AssertError(t, errs, "", "", "excludesall")
238+
239+
errs = validate.Field(s, "excludesall=0x7C")
240+
NotEqual(t, errs, nil)
241+
AssertError(t, errs, "", "", "excludesall")
242+
}
243+
232244
func TestBadKeyValidation(t *testing.T) {
233245
type Test struct {
234246
Name string `validate:"required, "`

0 commit comments

Comments
 (0)