1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 07:10:55 +00:00

added more test case

This commit is contained in:
Andrea Spacca 2018-02-01 18:30:31 +01:00
parent faa3341603
commit 453f112094

View File

@ -480,12 +480,40 @@ func TestPointer(t *testing.T) {
t.Fatal("validation should be passed")
}
u = User{
ReqEmail: &validEmail,
Email: nil,
}
valid = Validation{}
b, err = valid.Valid(u)
if err != nil {
t.Fatal(err)
}
if !b {
t.Fatal("validation should be passed")
}
invalidEmail := "a@a"
u = User{
ReqEmail: &validEmail,
Email: &invalidEmail,
}
valid = Validation{RequiredFirst: true}
b, err = valid.Valid(u)
if err != nil {
t.Fatal(err)
}
if b {
t.Fatal("validation should not be passed")
}
u = User{
ReqEmail: &validEmail,
Email: &invalidEmail,
}
valid = Validation{}
b, err = valid.Valid(u)
if err != nil {