зеркало из https://github.com/github/ruby.git
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:
Родитель
c05fa459bb
Коммит
e3c023337c
|
@ -28,9 +28,10 @@ class TestWeakMap < Test::Unit::TestCase
|
||||||
assert_raise(ArgumentError) {@wm[x] = :foo}
|
assert_raise(ArgumentError) {@wm[x] = :foo}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_include?
|
def assert_weak_include(m, k, n = 100)
|
||||||
m = __callee__[/test_(.*)/, 1]
|
if n > 0
|
||||||
k = "foo"
|
return assert_weak_include(m, k, n-1)
|
||||||
|
end
|
||||||
1.times do
|
1.times do
|
||||||
x = Object.new
|
x = Object.new
|
||||||
@wm[k] = x
|
@wm[k] = x
|
||||||
|
@ -38,6 +39,14 @@ class TestWeakMap < Test::Unit::TestCase
|
||||||
assert_not_send([@wm, m, "FOO".downcase])
|
assert_not_send([@wm, m, "FOO".downcase])
|
||||||
x = nil
|
x = nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_include?
|
||||||
|
m = __callee__[/test_(.*)/, 1]
|
||||||
|
k = "foo"
|
||||||
|
1.times do
|
||||||
|
assert_weak_include(m, k)
|
||||||
|
end
|
||||||
GC.start
|
GC.start
|
||||||
# skip('TODO: failure introduced from r60440')
|
# skip('TODO: failure introduced from r60440')
|
||||||
assert_not_send([@wm, m, k])
|
assert_not_send([@wm, m, k])
|
||||||
|
|
Загрузка…
Ссылка в новой задаче