mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
55c141c624
commit
f433d710d0
23 changed files with 364 additions and 88 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue