From b41909f603dce3c8f48d49514c50d6813a1ca491 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 12 Sep 2014 08:13:28 +0000 Subject: vm_method.c: should not modify frozen objects * vm_method.c (rb_method_entry_make, remove_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_class.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 963c497d2f..9a4cdb0f58 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -384,4 +384,13 @@ class TestClass < Test::Unit::TestCase Class.new.freeze.clone.to_s } end + + def test_singleton_class_of_frozen_object + obj = Object.new + c = obj.singleton_class + obj.freeze + assert_raise(RuntimeError, /frozen object/) { + c.class_eval {def f; end} + } + end end -- cgit v1.2.3