diff options
Diffstat (limited to 'test/ruby/test_weakmap.rb')
-rw-r--r-- | test/ruby/test_weakmap.rb | 11 |
1 files 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 |