From e3c023337cf97487d9f6b970014b45adf9708bc2 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 14 Mar 2018 11:55:07 +0000 Subject: [PATCH] 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 --- test/ruby/test_weakmap.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb index 35025c8201..32e321f48e 100644 --- a/test/ruby/test_weakmap.rb +++ b/test/ruby/test_weakmap.rb @@ -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])