add tests to ensure bool value require test always return true.
Showing
1 changed file
with
6 additions
and
0 deletions
| ... | @@ -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 | } | ... | ... |
-
Please register or sign in to post a comment