Skip to content

Commit 325b451

Browse files
committed
Ruby: Add barrier guards test involving captured variables
1 parent 966c6f1 commit 325b451

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,27 @@
3838
foo
3939
else
4040
foo
41-
end
41+
end
42+
43+
if foo == "foo"
44+
capture {
45+
foo # guarded
46+
}
47+
end
48+
49+
if foo == "foo"
50+
capture {
51+
foo = "bar"
52+
foo # not guarded
53+
}
54+
end
55+
56+
if foo == "foo"
57+
my_lambda = -> () {
58+
foo # not guarded
59+
}
60+
61+
foo = "bar"
62+
63+
my_lambda()
64+
end

0 commit comments

Comments
 (0)