Merge pull request #131 from philalex/fixBooleansComparaison-issue125

Fix booleans comparaison issue125
pull/132/head
Liz Rice 6 years ago committed by GitHub
commit 82b1e05a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -80,10 +80,22 @@ func (t *testItem) execute(s string) (result bool) {
switch t.Compare.Op {
case "eq":
result = flagVal == t.Compare.Value
value := strings.ToLower(flagVal)
// Do case insensitive comparaison for booleans ...
if value == "false" || value == "true" {
result = value == t.Compare.Value
} else {
result = flagVal == t.Compare.Value
}
case "noteq":
result = !(flagVal == t.Compare.Value)
value := strings.ToLower(flagVal)
// Do case insensitive comparaison for booleans ...
if value == "false" || value == "true" {
result = !(value == t.Compare.Value)
} else {
result = !(flagVal == t.Compare.Value)
}
case "gt":
a, b := toNumeric(flagVal, t.Compare.Value)

Loading…
Cancel
Save