summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-09-10 23:03:53 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-09-10 23:03:53 +0900
commit698b3c925d757cd7113f9916db2dbb7e2eabf2f4 (patch)
tree65f39e481766d5333657de62c2453b7612153831 /test
parent543ac88eae2afdf25364720b3b8cac9ce0748fad (diff)
downloadmruby-698b3c925d757cd7113f9916db2dbb7e2eabf2f4.tar.gz
mruby-698b3c925d757cd7113f9916db2dbb7e2eabf2f4.zip
add Hash#rehash to handle key modification; ref #2945
Diffstat (limited to 'test')
-rw-r--r--test/t/hash.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/t/hash.rb b/test/t/hash.rb
index eee7c7b6a..3196cc97a 100644
--- a/test/t/hash.rb
+++ b/test/t/hash.rb
@@ -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