test_weakmap.rb: fixing CI failures

* test/ruby/test_weakmap.rb (test_include?): create and release
  the object to be garbage-collected in deeper frame.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-03-14 11:55:07 +00:00
Родитель c05fa459bb
Коммит e3c023337c
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -28,9 +28,10 @@ class TestWeakMap < Test::Unit::TestCase
assert_raise(ArgumentError) {@wm[x] = :foo}
end
def test_include?
m = __callee__[/test_(.*)/, 1]
k = "foo"
def assert_weak_include(m, k, n = 100)
if n > 0
return assert_weak_include(m, k, n-1)
end
1.times do
x = Object.new
@wm[k] = x
@ -38,6 +39,14 @@ class TestWeakMap < Test::Unit::TestCase
assert_not_send([@wm, m, "FOO".downcase])
x = nil
end
end
def test_include?
m = __callee__[/test_(.*)/, 1]
k = "foo"
1.times do
assert_weak_include(m, k)
end
GC.start
# skip('TODO: failure introduced from r60440')
assert_not_send([@wm, m, k])