mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
check hash_hint is different.
This commit is contained in:
parent
a1a198d03a
commit
43d74776a1
1 changed files with 10 additions and 1 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Reference in a new issue