diff options
Diffstat (limited to 'test/ruby/test_class.rb')
-rw-r--r-- | test/ruby/test_class.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 55940a8891..3d894da03c 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -258,4 +258,19 @@ class TestClass < Test::Unit::TestCase END assert_equal(42, PrivateClass.new.foo) end + + def test_cannot_reinitialize_class_with_initialize_copy # [ruby-core:50869] + assert_in_out_err([], <<-RUBY, ["Object"], []) + class Class + def initialize_copy(*); super; end + end + + class A; end + class B; end + + A.send(:initialize_copy, Class.new(B)) rescue nil + + p A.superclass + RUBY + end end |