Updated to return bool false only for zero

This commit is contained in:
txgruppi 2014-11-19 18:08:49 +00:00
parent 770890fb15
commit ed6dd5ade6
No known key found for this signature in database
GPG Key ID: 36F5005FCAF5C057
2 changed files with 3 additions and 2 deletions

View File

@ -61,4 +61,5 @@ func TestToBool(t *testing.T) {
assert.Equal(t, ToBool("T"), true)
assert.Equal(t, ToBool(1), true)
assert.Equal(t, ToBool(true), true)
assert.Equal(t, ToBool(-1), true)
}

View File

@ -41,7 +41,7 @@ func ToBoolE(i interface{}) (bool, error) {
case nil:
return false, nil
case int:
if i.(int) > 0 {
if i.(int) != 0 {
return true, nil
}
return false, nil