diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-18 00:24:00 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-18 00:24:00 +0000 |
commit | a34a3c2caae4c1fbd9b4a0fa7194e0edfbad6bbe (patch) | |
tree | e6ecfaf77e13023217c22fcb83bbda11b2ebccc1 /test | |
parent | bff930ccf476e1a7e01720e2fd4f6c09d226a56f (diff) |
* hash.c (initialize_copy): duping should rehash the hash.
* test/ruby/test_hash.rb: added a test to ensure rehash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_hash.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index f1eef88d99..076146f5a4 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -100,6 +100,15 @@ class TestHash < Test::Unit::TestCase assert_raises(TypeError) { h.dup } end + def test_dup_will_rehash + set1 = { } + set2 = { set1 => true} + + set1[set1] = true + + assert_equal set2, set2.dup + end + def test_s_AREF h = @cls["a" => 100, "b" => 200] assert_equal(100, h['a']) |