From 343c363d5b1374f3aca6f9ba6d755a156d03f3f5 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 25 Aug 2007 20:56:51 +0000 Subject: * insnhelper.ci (vm_call_method): fix to relaxant safe level check ($SAFE > 2). [ruby-core:11998] * bootstraptest/test_method.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_method.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb index 776d6274a3..bca80087bb 100644 --- a/bootstraptest/test_method.rb +++ b/bootstraptest/test_method.rb @@ -916,3 +916,44 @@ assert_equal 'ok', %q{ end C.new.m } + +assert_equal 'ok', %q{ + proc{ + $SAFE = 1 + class C + def m + :ok + end + end + }.call + C.new.m +}, '[ruby-core:11998]' + +assert_equal 'ok', %q{ + proc{ + $SAFE = 2 + class C + def m + :ok + end + end + }.call + C.new.m +}, '[ruby-core:11998]' + +assert_equal 'ok', %q{ + proc{ + $SAFE = 3 + class C + def m + :ng + end + end + }.call + begin + C.new.m + rescue SecurityError + :ok + end +}, '[ruby-core:11998]' + -- cgit v1.2.3