add more unit testing case for package gvalid

This commit is contained in:
John Guo 2021-03-30 15:25:26 +08:00
parent 78027d2ec6
commit 9c70fe3be8

View File

@ -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)
})
}