1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 19:00:50 +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
parent 5fa55ca2d3
commit caa260f053

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