mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
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:
@@ -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 |
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user