summaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 20:56:51 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 20:56:51 +0000
commitebd940b0b758262330ac8d08b1a2f7130ae1cce5 (patch)
tree59306515b95c4da5997a2a1380652d9f6764ae32 /bootstraptest
parenta8454f5691ca8b6e078b118a012ed3095ddb7087 (diff)
downloadruby-ebd940b0b758262330ac8d08b1a2f7130ae1cce5.tar.gz
ruby-ebd940b0b758262330ac8d08b1a2f7130ae1cce5.tar.xz
ruby-ebd940b0b758262330ac8d08b1a2f7130ae1cce5.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_method.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index 776d6274a..bca80087b 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]'
+