diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-15 09:28:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-15 09:28:45 +0000 |
commit | bb34f5fe8bba8f282f7af90185ae1f9aae45ee14 (patch) | |
tree | 26aaef512e2e6f18906d627e534b67e1a0938b51 /test | |
parent | 6d39da66bcac5e41aeab2c2c9415e731f58dece4 (diff) | |
download | ruby-bb34f5fe8bba8f282f7af90185ae1f9aae45ee14.tar.gz |
vm_method.c: check if frozen [Fix GH-1096]
* vm_method.c (set_method_visibility): should fail if the receiver
is frozen. [ruby-core:71489] [Bug #11687]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_module.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 19cf418cf1..dbbeca850d 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -624,13 +624,22 @@ class TestModule < Test::Unit::TestCase end def test_freeze - m = Module.new + m = Module.new do + def self.baz; end + def bar; end + end m.freeze assert_raise(RuntimeError) do m.module_eval do def foo; end end end + assert_raise(RuntimeError) do + m.__send__ :private, :bar + end + assert_raise(RuntimeError) do + m.private_class_method :baz + end end def test_attr_obsoleted_flag |