From fae9930033c786f61616be8a053368e80f0e60a8 Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 14 Dec 2010 02:34:46 +0000 Subject: [PATCH] * test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink the renamed temporary file on no_safe_rename platforms. * test/ruby/test_argf.rb (test_readlines_limit_0, test_each_line_limit_0): should close argf because the associated Tempfile object cannot unlink the temporary file when it's gc'ed on some platforms (Windows, etc.) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 10 ++++++++++ test/ruby/test_argf.rb | 18 ++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6bfc5eee6..73ca4574b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Dec 14 11:30:17 2010 NAKAMURA Usaku + + * test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink + the renamed temporary file on no_safe_rename platforms. + + * test/ruby/test_argf.rb (test_readlines_limit_0, + test_each_line_limit_0): should close argf because the associated + Tempfile object cannot unlink the temporary file when it's gc'ed + on some platforms (Windows, etc.) + Tue Dec 14 11:27:07 2010 NARUSE, Yui * lib/minitest/unit.rb (Minitest::Unit#_run_suite): split test diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index 992c37b261..b8b40ec077 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -210,6 +210,7 @@ class TestArgf < Test::Unit::TestCase assert_equal([], e) assert_equal([], r) assert_equal("foo.new\nbar.new\nbaz.new\n", File.read(t.path)) + File.unlink(t.path + ".~~~") rescue nil else assert_match(/Can't rename .* to .*: .*. skipping file/, e.first) #' assert_equal([], r) @@ -699,8 +700,12 @@ class TestArgf < Test::Unit::TestCase bug4024 = '[ruby-dev:42538]' t = make_tempfile argf = ARGF.class.new(t.path) - assert_raise(ArgumentError, bug4024) do - argf.readlines(0) + begin + assert_raise(ArgumentError, bug4024) do + argf.readlines(0) + end + ensure + argf.close end end @@ -708,8 +713,13 @@ class TestArgf < Test::Unit::TestCase bug4024 = '[ruby-dev:42538]' t = make_tempfile argf = ARGF.class.new(t.path) - assert_raise(ArgumentError, bug4024) do - argf.each_line(0).next + begin + assert_raise(ArgumentError, bug4024) do + argf.each_line(0).next + end + ensure + argf.close end + end end