diff options
Diffstat (limited to 'test/ruby/test_eval.rb')
-rw-r--r-- | test/ruby/test_eval.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 6e39374a9c..876aaafc08 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -358,4 +358,21 @@ class TestEval < Test::Unit::TestCase } end + def test_eval_using_integer_as_binding + assert_raise(TypeError) { eval("", 1) } + end + + def test_eval_raise + assert_raise(RuntimeError) { eval("raise ''") } + end + + def test_eval_using_untainted_binding_under_safe4 + assert_raise(SecurityError) do + Thread.new do + b = binding + $SAFE = 4 + eval("", b) + end.join + end + end end |