add Hash#rehash to handle key modification; ref #2945

This commit is contained in:
Yukihiro "Matz" Matsumoto
2015-09-10 23:03:53 +09:00
parent 543ac88eae
commit 698b3c925d
2 changed files with 32 additions and 0 deletions
+9
View File
@@ -342,3 +342,12 @@ assert('Hash#inspect') do
assert_include ret, '"a"=>100'
assert_include ret, '"d"=>400'
end
assert('Hash#rehash') do
h = {[:a] => "b"}
# hash key modified
h.keys[0][0] = :b
# h[[:b]] => nil
h.rehash
assert_equal("b", h[[:b]])
end