From 43d74776a1465095ab6b420809cc278d4f95f7bc Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Thu, 1 Aug 2019 05:21:42 +0900 Subject: check hash_hint is different. --- test/ruby/test_hash.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/ruby/test_hash.rb') 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]) -- cgit v1.2.3