diff options
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 |