mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
add more unit testing case for package gvalid
This commit is contained in:
parent
78027d2ec6
commit
9c70fe3be8
@ -335,3 +335,20 @@ func Test_CheckStruct_NoTag(t *testing.T) {
|
||||
t.Assert(err, nil)
|
||||
})
|
||||
}
|
||||
|
||||
func Test_CheckStruct_InvalidRule(t *testing.T) {
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
type Params struct {
|
||||
Name string
|
||||
Age uint
|
||||
Phone string `v:"mobile"`
|
||||
}
|
||||
obj := &Params{
|
||||
Name: "john",
|
||||
Age: 18,
|
||||
Phone: "123",
|
||||
}
|
||||
err := gvalid.CheckStruct(obj, nil)
|
||||
t.AssertNE(err, nil)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user