mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
Ruby: re-add Eval.rb
This commit is contained in:
24
ruby/ql/test/library-tests/frameworks/core/Eval.rb
Normal file
24
ruby/ql/test/library-tests/frameworks/core/Eval.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# Uses of eval and send
|
||||
|
||||
eval("raise \"error\"", binding, "file", 1)
|
||||
send("raise", "error")
|
||||
|
||||
a = []
|
||||
a.send("push", "1")
|
||||
|
||||
class Foo
|
||||
def eval(x)
|
||||
x + 1
|
||||
end
|
||||
|
||||
def send(*args)
|
||||
2
|
||||
end
|
||||
|
||||
def run
|
||||
eval("exit 1")
|
||||
end
|
||||
end
|
||||
|
||||
Foo.new.send("exit", 1)
|
||||
Foo.module_eval("def bar; 1; end", "other_file.rb", 2)
|
||||
@@ -38,7 +38,10 @@ kernelSpawnCallExecutions
|
||||
| Kernel.rb:68:1:68:61 | call to spawn |
|
||||
| Kernel.rb:69:1:69:71 | call to spawn |
|
||||
sendCallCodeExecutions
|
||||
| Eval.rb:4:1:4:22 | call to send | Eval.rb:4:6:4:12 | "raise" |
|
||||
| Eval.rb:7:1:7:19 | call to send | Eval.rb:7:8:7:13 | "push" |
|
||||
| Kernel.rb:2:1:2:22 | call to send | Kernel.rb:2:6:2:12 | "raise" |
|
||||
| Kernel.rb:5:1:5:19 | call to send | Kernel.rb:5:8:5:13 | "push" |
|
||||
evalCallCodeExecutions
|
||||
| Eval.rb:3:1:3:43 | call to eval | Eval.rb:3:6:3:22 | "raise \\"error\\"" |
|
||||
| Kernel.rb:1:1:1:43 | call to eval | Kernel.rb:1:6:1:22 | "raise \\"error\\"" |
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
classEvalCallCodeExecutions
|
||||
| Module.rb:29:1:29:47 | call to class_eval | Module.rb:29:16:29:32 | "def foo; 1; end" |
|
||||
moduleEvalCallCodeExecutions
|
||||
| Eval.rb:24:1:24:54 | call to module_eval | Eval.rb:24:17:24:33 | "def bar; 1; end" |
|
||||
| Module.rb:30:1:30:54 | call to module_eval | Module.rb:30:17:30:33 | "def bar; 1; end" |
|
||||
moduleConstGetCallCodeExecutions
|
||||
| Module.rb:1:1:1:24 | call to const_get | Module.rb:1:18:1:23 | "Math" |
|
||||
|
||||
Reference in New Issue
Block a user