From f1f609bc22a8aea2de4a3d564147ffb73a9ac211 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 13 Dec 2013 13:29:07 +0000 Subject: [PATCH] test_weakmap.rb: fix test * test/ruby/test_weakmap.rb (test_include?): isolate weak referenced object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_weakmap.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb index 053ad88cfa..bc88ab0dd0 100644 --- a/test/ruby/test_weakmap.rb +++ b/test/ruby/test_weakmap.rb @@ -30,12 +30,13 @@ class TestWeakMap < Test::Unit::TestCase def test_include? m = __callee__[/test_(.*)/, 1] - x = Object.new k = "foo" - @wm[k] = x - assert_send([@wm, m, k]) - assert_not_send([@wm, m, "FOO".downcase]) - x = nil + Object.new do |x| + @wm[k] = x + assert_send([@wm, m, k]) + assert_not_send([@wm, m, "FOO".downcase]) + x = nil + end GC.start assert_not_send([@wm, m, k]) end