diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-08-01 05:21:42 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-08-01 05:21:42 +0900 |
commit | 43d74776a1465095ab6b420809cc278d4f95f7bc (patch) | |
tree | 68b0be6472e91e30f17fe5fa1d2030c515a6a4a9 /test/ruby | |
parent | a1a198d03af6b285dbee552da5e40e7c3061e6c9 (diff) | |
download | ruby-43d74776a1465095ab6b420809cc278d4f95f7bc.tar.gz |
check hash_hint is different.
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_hash.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index edf335eaa6..8f6d782af4 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -670,12 +670,21 @@ class TestHash < Test::Unit::TestCase assert_not_send([@h, :member?, 'gumby']) end + def hash_hint hv + hv & 0xff + end + def test_rehash a = [ "a", "b" ] c = [ "c", "d" ] h = @cls[ a => 100, c => 300 ] assert_equal(100, h[a]) - a[0] = "z" + + hv = a.hash + begin + a[0] << "z" + end while hash_hint(a.hash) == hash_hint(hv) + assert_nil(h[a]) h.rehash assert_equal(100, h[a]) |