diff options
-rw-r--r-- | test/lib/leakchecker.rb | 4 | ||||
-rw-r--r-- | test/test_tempfile.rb | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/test/lib/leakchecker.rb b/test/lib/leakchecker.rb index 355f93dc79..c0cf718635 100644 --- a/test/lib/leakchecker.rb +++ b/test/lib/leakchecker.rb @@ -114,7 +114,9 @@ class LeakChecker if prev_count == count [prev_count, []] else - tempfiles = ObjectSpace.each_object(Tempfile).find_all {|t| t.path } + tempfiles = ObjectSpace.each_object(Tempfile).find_all {|t| + t.instance_variable_defined?(:@tmpfile) and t.path + } [count, tempfiles] end end diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb index 361613173f..7f7f75c7db 100644 --- a/test/test_tempfile.rb +++ b/test/test_tempfile.rb @@ -20,6 +20,10 @@ class TestTempfile < Test::Unit::TestCase end end + def test_leackchecker + assert_instance_of(Tempfile, Tempfile.allocate) + end + def test_basic t = tempfile("foo") path = t.path |