mirror of
https://github.com/ruby/ruby.git
synced 2025-09-24 04:54:01 +02:00
class.c: do not freeze meta-meta-class
* class.c (rb_freeze_singleton_class): should not propagate to meta-meta-class, and so on, which is shared with the original class. fix occational exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c7d0edb5b6
commit
d9a597408f
3 changed files with 29 additions and 6 deletions
|
@ -914,25 +914,34 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_include(c.constants(false), :Foo, bug9413)
|
||||
end
|
||||
|
||||
def test_frozen_class
|
||||
def test_frozen_module
|
||||
m = Module.new
|
||||
m.freeze
|
||||
assert_raise(RuntimeError) do
|
||||
m.instance_eval { undef_method(:foo) }
|
||||
end
|
||||
end
|
||||
|
||||
def test_frozen_class
|
||||
c = Class.new
|
||||
c.freeze
|
||||
assert_raise(RuntimeError) do
|
||||
c.instance_eval { undef_method(:foo) }
|
||||
end
|
||||
end
|
||||
|
||||
o = Object.new
|
||||
def test_frozen_singleton_class
|
||||
klass = Class.new
|
||||
o = klass.new
|
||||
c = class << o; self; end
|
||||
c.freeze
|
||||
assert_raise(RuntimeError) do
|
||||
assert_raise_with_message(RuntimeError, /frozen/) do
|
||||
c.instance_eval { undef_method(:foo) }
|
||||
end
|
||||
klass.class_eval do
|
||||
def self.foo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_method_defined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue