summaryrefslogtreecommitdiff
path: root/test/ruby/test_class.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-12 08:13:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-12 08:13:28 +0000
commitb41909f603dce3c8f48d49514c50d6813a1ca491 (patch)
tree4d3b74fb148cec78c9940017a013179079151c98 /test/ruby/test_class.rb
parent94ee7c47cd5f818eb72cc9830bfcf23a642bff3f (diff)
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
Diffstat (limited to 'test/ruby/test_class.rb')
-rw-r--r--test/ruby/test_class.rb9
1 files changed, 9 insertions, 0 deletions
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