Skip to content

Commit 4ca2bfb

Browse files
committed
add panic tests for invalid field types in printable ASCII and ASCII validation
1 parent 880ef4e commit 4ca2bfb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

validator_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,6 +3940,8 @@ func TestPrintableASCIIValidation(t *testing.T) {
39403940
}
39413941
}
39423942
}
3943+
PanicMatches(t, func() { _ = validate.Var([]int{3000}, "printascii") }, "Bad field type []int")
3944+
PanicMatches(t, func() { _ = validate.Var(1, "printascii") }, "Bad field type int")
39433945
}
39443946

39453947
func TestASCIIValidation(t *testing.T) {
@@ -3979,6 +3981,8 @@ func TestASCIIValidation(t *testing.T) {
39793981
}
39803982
}
39813983
}
3984+
PanicMatches(t, func() { _ = validate.Var([]int{3000}, "ascii") }, "Bad field type []int")
3985+
PanicMatches(t, func() { _ = validate.Var(1, "ascii") }, "Bad field type int")
39823986
}
39833987

39843988
func TestUUID5Validation(t *testing.T) {

0 commit comments

Comments
 (0)