зеркало из https://github.com/github/ruby.git
check hash_hint is different.
This commit is contained in:
Родитель
a1a198d03a
Коммит
43d74776a1
|
@ -670,12 +670,21 @@ class TestHash < Test::Unit::TestCase
|
||||||
assert_not_send([@h, :member?, 'gumby'])
|
assert_not_send([@h, :member?, 'gumby'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hash_hint hv
|
||||||
|
hv & 0xff
|
||||||
|
end
|
||||||
|
|
||||||
def test_rehash
|
def test_rehash
|
||||||
a = [ "a", "b" ]
|
a = [ "a", "b" ]
|
||||||
c = [ "c", "d" ]
|
c = [ "c", "d" ]
|
||||||
h = @cls[ a => 100, c => 300 ]
|
h = @cls[ a => 100, c => 300 ]
|
||||||
assert_equal(100, h[a])
|
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])
|
assert_nil(h[a])
|
||||||
h.rehash
|
h.rehash
|
||||||
assert_equal(100, h[a])
|
assert_equal(100, h[a])
|
||||||
|
|
Загрузка…
Ссылка в новой задаче