mirror of https://github.com/spf13/cast.git
Updated to return bool false only for zero
This commit is contained in:
parent
770890fb15
commit
ed6dd5ade6
|
@ -53,7 +53,7 @@ func TestToBool(t *testing.T) {
|
||||||
assert.Equal(t, ToBool("F"), false)
|
assert.Equal(t, ToBool("F"), false)
|
||||||
assert.Equal(t, ToBool(false), false)
|
assert.Equal(t, ToBool(false), false)
|
||||||
assert.Equal(t, ToBool("foo"), false)
|
assert.Equal(t, ToBool("foo"), false)
|
||||||
|
|
||||||
assert.Equal(t, ToBool("true"), true)
|
assert.Equal(t, ToBool("true"), true)
|
||||||
assert.Equal(t, ToBool("TRUE"), true)
|
assert.Equal(t, ToBool("TRUE"), true)
|
||||||
assert.Equal(t, ToBool("True"), true)
|
assert.Equal(t, ToBool("True"), true)
|
||||||
|
@ -61,4 +61,5 @@ func TestToBool(t *testing.T) {
|
||||||
assert.Equal(t, ToBool("T"), true)
|
assert.Equal(t, ToBool("T"), true)
|
||||||
assert.Equal(t, ToBool(1), true)
|
assert.Equal(t, ToBool(1), true)
|
||||||
assert.Equal(t, ToBool(true), true)
|
assert.Equal(t, ToBool(true), true)
|
||||||
|
assert.Equal(t, ToBool(-1), true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue