diff options
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 95758aa6d4..ce5ab2ff73 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -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 |