Add unless x != test to barrier guards

This tests that the following call to `foo bar` is guarded:

    unless bar != "bar"
      foo bar
    end
This commit is contained in:
Harry Maclean
2021-09-13 11:58:17 +01:00
parent 800e18349f
commit 6f32401e5c
2 changed files with 21 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
| barrier-guards.rb:3:4:3:15 | ... == ... | barrier-guards.rb:4:13:4:15 | foo | barrier-guards.rb:3:4:3:6 | foo | true |
| barrier-guards.rb:9:4:9:24 | call to include? | barrier-guards.rb:10:13:10:15 | foo | barrier-guards.rb:9:21:9:23 | foo | true |
| barrier-guards.rb:15:4:15:15 | ... != ... | barrier-guards.rb:18:14:18:16 | foo | barrier-guards.rb:15:4:15:6 | foo | false |
| barrier-guards.rb:3:4:3:15 | ... == ... | barrier-guards.rb:4:5:4:7 | foo | barrier-guards.rb:3:4:3:6 | foo | true |
| barrier-guards.rb:9:4:9:24 | call to include? | barrier-guards.rb:10:5:10:7 | foo | barrier-guards.rb:9:21:9:23 | foo | true |
| barrier-guards.rb:15:4:15:15 | ... != ... | barrier-guards.rb:18:5:18:7 | foo | barrier-guards.rb:15:4:15:6 | foo | false |
| barrier-guards.rb:21:8:21:19 | ... == ... | barrier-guards.rb:24:5:24:7 | foo | barrier-guards.rb:21:8:21:10 | foo | true |
| barrier-guards.rb:27:8:27:19 | ... != ... | barrier-guards.rb:28:5:28:7 | foo | barrier-guards.rb:27:8:27:10 | foo | false |

View File

@@ -1,22 +1,31 @@
foo = "foo"
if foo == "foo"
do_true foo
foo
else
do_false foo
foo
end
if ["foo"].include?(foo)
do_true foo
foo
else
do_false foo
foo
end
if foo != "foo"
do_true foo
foo
else
do_false foo
foo
end
do_default foo
unless foo == "foo"
foo
else
foo
end
unless foo != "foo"
foo
end
foo