1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 15:40:49 +00:00

add tests to ensure bool value require test always return true.

This commit is contained in:
pylemon 2015-03-27 13:43:20 +08:00 committed by astaxie
parent 91886a4547
commit 2c9363d29b

View File

@ -26,6 +26,12 @@ func TestRequired(t *testing.T) {
if valid.Required(nil, "nil").Ok {
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 {
t.Error("\"'\" string should be false")
}