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
This commit is contained in:
nobu 2015-11-15 09:28:45 +00:00
parent 9fec02ad20
commit 4ea616b387
3 changed files with 16 additions and 1 deletions

View file

@ -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