summaryrefslogtreecommitdiff
path: root/test/ruby/test_weakmap.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-13 13:29:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-13 13:29:07 +0000
commitf1f609bc22a8aea2de4a3d564147ffb73a9ac211 (patch)
tree8e7c3a8ddeab81d95bc1200679947d580a364bca /test/ruby/test_weakmap.rb
parent3ac0ec4ecdea849143ed64e8935e6675b341e44b (diff)
downloadruby-f1f609bc22a8aea2de4a3d564147ffb73a9ac211.tar.gz
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
Diffstat (limited to 'test/ruby/test_weakmap.rb')
-rw-r--r--test/ruby/test_weakmap.rb11
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