Skip to content

Commit 301914d

Browse files
committed
Ruby: Add an extra barrier guard test
1 parent 706d1d2 commit 301914d

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
| barrier-guards.rb:27:8:27:19 | ... != ... | barrier-guards.rb:28:5:28:7 | foo | barrier-guards.rb:27:8:27:10 | foo | false |
66
| barrier-guards.rb:37:4:37:20 | call to include? | barrier-guards.rb:38:5:38:7 | foo | barrier-guards.rb:37:17:37:19 | foo | true |
77
| barrier-guards.rb:43:4:43:15 | ... == ... | barrier-guards.rb:45:9:45:11 | foo | barrier-guards.rb:43:4:43:6 | foo | true |
8-
| barrier-guards.rb:69:4:69:21 | call to include? | barrier-guards.rb:70:5:70:7 | foo | barrier-guards.rb:69:18:69:20 | foo | true |
8+
| barrier-guards.rb:70:4:70:21 | call to include? | barrier-guards.rb:71:5:71:7 | foo | barrier-guards.rb:70:18:70:20 | foo | true |

ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.rb

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,30 @@
6363
my_lambda()
6464
end
6565

66+
foos = nil
6667
foos = ["foo"]
67-
bars = ["bar"]
68+
bars = NotAnArray.new
6869

6970
if foos.include?(foo)
7071
foo
7172
else
7273
foo
73-
end
74+
end
75+
76+
if bars.include?(foo)
77+
foo
78+
else
79+
foo
80+
end
81+
82+
bars = ["bar"]
83+
84+
if condition
85+
bars = nil
86+
end
87+
88+
if bars.include?(foo)
89+
foo
90+
else
91+
foo
92+
end

0 commit comments

Comments
 (0)