mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 04:01:29 +00:00
add tests to ensure bool value require test always return true.
This commit is contained in:
parent
91886a4547
commit
2c9363d29b
@ -26,6 +26,12 @@ func TestRequired(t *testing.T) {
|
|||||||
if valid.Required(nil, "nil").Ok {
|
if valid.Required(nil, "nil").Ok {
|
||||||
t.Error("nil object should be false")
|
t.Error("nil object should be false")
|
||||||
}
|
}
|
||||||
|
if !valid.Required(true, "bool").Ok {
|
||||||
|
t.Error("Bool value should always return true")
|
||||||
|
}
|
||||||
|
if !valid.Required(false, "bool").Ok {
|
||||||
|
t.Error("Bool value should always return true")
|
||||||
|
}
|
||||||
if valid.Required("", "string").Ok {
|
if valid.Required("", "string").Ok {
|
||||||
t.Error("\"'\" string should be false")
|
t.Error("\"'\" string should be false")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user