Skip to content

Commit

Permalink
Do case insensitive comparaison for booleans - Fix #125
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe ALEXANDRE committed May 15, 2018
1 parent c808d95 commit c4e7487
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions check/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,20 @@ func (t *testItem) execute(s string) (result bool) {

switch t.Compare.Op {
case "eq":
result = flagVal == t.Compare.Value
// 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)
// 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 c4e7487

Please # to comment.