Skip to content

Commit

Permalink
Merge pull request #131 from philalex/fixBooleansComparaison-issue125
Browse files Browse the repository at this point in the history
Fix booleans comparaison issue125
  • Loading branch information
lizrice authored May 15, 2018
2 parents c0d80b4 + 97e5bc9 commit 82b1e05
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions check/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 82b1e05

Please # to comment.