Merge pull request #5 from txgruppi/master

Updated to return bool false only for zero
This commit is contained in:
Steve Francia 2014-12-03 08:50:16 +01:00
commit fb4a45a374
2 changed files with 2 additions and 1 deletions

View File

@ -63,4 +63,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