diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_method.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 9fc2ab10eb..c8b5ff12d3 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -864,4 +864,17 @@ class TestMethod < Test::Unit::TestCase n = 10_000_000 assert_equal n , rest_parameter(*(1..n)).size, '[Feature #10440]' end + + def test_insecure_method + m = "\u{5371 967a}" + c = Class.new do + proc {$SAFE=3;def foo;end}.call + alias_method m, "foo" + eval "def bar; #{m}; end" + end + obj = c.new + assert_raise_with_message(SecurityError, /#{m}/) do + obj.bar + end + end end |