class.c: do nothing if copying self

* class.c (rb_mod_init_copy): do nothing if copying self.
  [ruby-dev:47989] [Bug #9535]
* hash.c (rb_hash_initialize_copy): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-02-21 11:42:03 +00:00
parent 5258f67d17
commit 1f29e8e2ba
8 changed files with 32 additions and 2 deletions

View file

@ -364,6 +364,17 @@ class TestModule < Test::Unit::TestCase
assert_equal([:MIXIN, :USER], User.constants.sort)
end
def test_self_initialize_copy
bug9535 = '[ruby-dev:47989] [Bug #9535]'
m = Module.new do
def foo
:ok
end
initialize_copy(self)
end
assert_equal(:ok, Object.new.extend(m).foo, bug9535)
end
def test_dup
bug6454 = '[ruby-core:45132]'