[前][次][番号順一覧][スレッド一覧]

ruby-changes:18178

From: usa <ko1@a...>
Date: Tue, 14 Dec 2010 11:35:02 +0900 (JST)
Subject: [ruby-changes:18178] Ruby:r30199 (trunk): * test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink

usa	2010-12-14 11:34:46 +0900 (Tue, 14 Dec 2010)

  New Revision: 30199

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30199

  Log:
    * 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.)

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_argf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30198)
+++ ChangeLog	(revision 30199)
@@ -1,3 +1,13 @@
+Tue Dec 14 11:30:17 2010  NAKAMURA Usaku  <usa@r...>
+
+	* 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  <naruse@r...>
 
 	* lib/minitest/unit.rb (Minitest::Unit#_run_suite): split test
Index: test/ruby/test_argf.rb
===================================================================
--- test/ruby/test_argf.rb	(revision 30198)
+++ test/ruby/test_argf.rb	(revision 30199)
@@ -210,6 +210,7 @@
         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 @@
     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 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]