mirror of
https://gitee.com/johng/gf
synced 2026-07-07 22:27:06 +08:00
"gvalid length" compatible with only one parameter
This commit is contained in:
@ -658,6 +658,17 @@ func Test_Length(t *testing.T) {
|
||||
if m := gvalid.CheckValue(context.TODO(), "12345", rule, nil); m == nil {
|
||||
t.Error("长度校验失败")
|
||||
}
|
||||
// only one parameter
|
||||
rule2 := "length:5"
|
||||
if m := gvalid.CheckValue(context.TODO(), "1234", rule2, nil); m == nil {
|
||||
t.Error(m)
|
||||
}
|
||||
if m := gvalid.CheckValue(context.TODO(), "12345", rule2, nil); m != nil {
|
||||
t.Error(m)
|
||||
}
|
||||
if m := gvalid.CheckValue(context.TODO(), "123456", rule2, nil); m == nil {
|
||||
t.Error("长度校验失败")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_MinLength(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user