mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 00:30:48 +00:00
add tests to ensure bool value require test always return true.
This commit is contained in:
parent
5fa55ca2d3
commit
caa260f053
@ -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