From ff2252ab223e0814c3868185380b62128be50ccf Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 9 Aug 2009 18:32:54 -0700 Subject: test_util: explicitly close tempfiles for GC-safety Otherwise they might be picked up by the GC during the other tests (exposed by Ruby 1.9.1-p243). --- test/unit/test_util.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb index 032f0be..99c1cef 100644 --- a/test/unit/test_util.rb +++ b/test/unit/test_util.rb @@ -15,6 +15,7 @@ class TestUtil < Test::Unit::TestCase assert_equal before, File.stat(tmp.path).inspect assert_equal ext, (tmp.external_encoding rescue nil) assert_equal int, (tmp.internal_encoding rescue nil) + assert_nothing_raised { tmp.close! } end def test_reopen_logs_renamed @@ -37,6 +38,8 @@ class TestUtil < Test::Unit::TestCase assert_equal int, (tmp.internal_encoding rescue nil) assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & tmp.fcntl(Fcntl::F_GETFL)) assert tmp.sync + assert_nothing_raised { tmp.close! } + assert_nothing_raised { to.close! } end def test_reopen_logs_renamed_with_encoding @@ -59,6 +62,7 @@ class TestUtil < Test::Unit::TestCase assert fp.sync } } + assert_nothing_raised { tmp.close! } end if STDIN.respond_to?(:external_encoding) def test_reopen_logs_renamed_with_internal_encoding @@ -84,6 +88,7 @@ class TestUtil < Test::Unit::TestCase } } } + assert_nothing_raised { tmp.close! } end if STDIN.respond_to?(:external_encoding) end -- cgit v1.2.3-24-ge0c7