Skip to content

Commit 007d08e

Browse files
committed
Ruby: Add another variable capture test
1 parent 8bbfb82 commit 007d08e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ruby/ql/test/library-tests/dataflow/global/Flow.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
testFailures
2+
| captured_variables.rb:227:13:227:31 | # $ hasValueFlow=18 | Missing result:hasValueFlow=18 |
23
edges
34
| blocks.rb:14:12:14:20 | call to source | blocks.rb:8:10:8:14 | yield ... | provenance | |
45
| captured_variables.rb:9:24:9:24 | x | captured_variables.rb:10:10:10:23 | -> { ... } [captured x] | provenance | |

ruby/ql/test/library-tests/dataflow/global/captured_variables.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,17 @@ class CaptureOverwrite
214214

215215
fn.call()
216216
end
217+
218+
def multi_capture
219+
x = taint(18)
220+
y = 123
221+
222+
fn1 = -> {
223+
y = x
224+
}
225+
226+
fn1.call()
227+
sink(y) # $ hasValueFlow=18
228+
end
229+
230+
multi_capture

0 commit comments

Comments
 (0)