diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 07:25:05 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 07:25:05 +0000 |
commit | f433d710d0ab3b367cc4a851cdfb81c5405bb7f8 (patch) | |
tree | 5d6a14de43873b9ddaec533051b942cf89c201ce /test/ruby/test_module.rb | |
parent | 55c141c6247a4d8c052c0d57f59ddaa29e3e523a (diff) | |
download | ruby-f433d710d0ab3b367cc4a851cdfb81c5405bb7f8.tar.gz |
* object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
(rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
test/ruby/test_object.rb, test/ruby/test_string.rb,
test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
Object#untrusted?.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 247ecc12be..edbbf250dd 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -699,4 +699,22 @@ class TestModule < Test::Unit::TestCase assert_equal(true, c2.include?(m)) assert_equal(false, m.include?(m)) end + + def test_include_under_safe4 + m = Module.new + c1 = Class.new + assert_raise(SecurityError) do + lambda { + $SAFE = 4 + c1.instance_eval { include(m) } + }.call + end + assert_nothing_raised do + lambda { + $SAFE = 4 + c2 = Class.new + c2.instance_eval { include(m) } + }.call + end + end end |