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

ruby-changes:63143

From: Benoit <ko1@a...>
Date: Sat, 26 Sep 2020 19:37:39 +0900 (JST)
Subject: [ruby-changes:63143] dead747874 (master): Use Tempfile.create instead of Tempfile.open in test_io.rb

https://git.ruby-lang.org/ruby.git/commit/?id=dead747874

From dead7478748a828c45e16134fca812bc7771344e Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Sat, 26 Sep 2020 12:36:31 +0200
Subject: Use Tempfile.create instead of Tempfile.open in test_io.rb


diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 7b1ddce..4bb8a1d 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2737,7 +2737,7 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2737
 
   def test_flush_in_finalizer1
     bug3910 = '[ruby-dev:42341]'
-    tmp = Tempfile.open("bug3910") {|t|
+    Tempfile.create("bug3910") {|t|
       path = t.path
       t.close
       fds = []
@@ -2757,12 +2757,11 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2757
         f.close
       end
     }
-    tmp.close!
   end
 
   def test_flush_in_finalizer2
     bug3910 = '[ruby-dev:42341]'
-    Tempfile.open("bug3910") {|t|
+    Tempfile.create("bug3910") {|t|
       path = t.path
       t.close
       begin
@@ -2781,7 +2780,6 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2780
           end
         }
       end
-      t.close!
     }
   end
 
@@ -3400,10 +3398,17 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3398
 
       tempfiles = []
       (0..fd_setsize+1).map {|i|
-        tempfiles << Tempfile.open("test_io_select_with_many_files")
+        tempfiles << Tempfile.create("test_io_select_with_many_files")
       }
 
-      IO.select(tempfiles)
+      begin
+        IO.select(tempfiles)
+      ensure
+        tempfiles.each { |t|
+          t.close
+          File.unlink(t.path)
+        }
+      end
     }, bug8080, timeout: 100
   end if defined?(Process::RLIMIT_NOFILE)
 
-- 
cgit v0.10.2


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

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