2c9363d2 by pylemon Committed by astaxie

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

1 parent 91886a45
...@@ -26,6 +26,12 @@ func TestRequired(t *testing.T) { ...@@ -26,6 +26,12 @@ func TestRequired(t *testing.T) {
26 if valid.Required(nil, "nil").Ok { 26 if valid.Required(nil, "nil").Ok {
27 t.Error("nil object should be false") 27 t.Error("nil object should be false")
28 } 28 }
29 if !valid.Required(true, "bool").Ok {
30 t.Error("Bool value should always return true")
31 }
32 if !valid.Required(false, "bool").Ok {
33 t.Error("Bool value should always return true")
34 }
29 if valid.Required("", "string").Ok { 35 if valid.Required("", "string").Ok {
30 t.Error("\"'\" string should be false") 36 t.Error("\"'\" string should be false")
31 } 37 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!