diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-22 00:50:33 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-22 00:50:33 +0000 |
commit | 9e11c028e3ff12da9e44f1ece7d100b84834e183 (patch) | |
tree | e4cb1f38eaef871e9132a97a9dc5ef96f71afe55 /test | |
parent | 941bd1c392d9213193804ef9be503c5d039dda04 (diff) |
merge revision(s) 45076: [Backport #9535]
* 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/branches/ruby_1_9_3@45091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_hash.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index af3fa78e0a..019196bd2e 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -117,6 +117,12 @@ class TestHash < Test::Unit::TestCase end + def test_self_initialize_copy + h = @cls[1=>2] + h.instance_eval {initialize_copy(h)} + assert_equal(2, h[1]) + end + def test_AREF # '[]' t = Time.now h = @cls[ @@ -145,8 +151,6 @@ class TestHash < Test::Unit::TestCase assert_equal('nil', h1[nil]) assert_equal(nil, h1['nil']) assert_equal(:default, h1['koala']) - - end def test_ASET # '[]=' diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index e72a6ab8c9..1fe67df2be 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -277,6 +277,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_included_modules assert_equal([], Mixin.included_modules) assert_equal([Mixin], User.included_modules) |