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

ruby-changes:34037

From: akr <ko1@a...>
Date: Sun, 25 May 2014 23:16:09 +0900 (JST)
Subject: [ruby-changes:34037] akr:r46118 (trunk): * test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove

akr	2014-05-25 23:16:02 +0900 (Sun, 25 May 2014)

  New Revision: 46118

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

  Log:
    * test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove
      tempfiles.

  Modified files:
    trunk/ChangeLog
    trunk/test/lib/minitest/unit.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46117)
+++ ChangeLog	(revision 46118)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 25 23:02:06 2014  Tanaka Akira  <akr@f...>
+
+	* test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove
+	  tempfiles.
+
 Sun May 25 22:42:27 2014  Tanaka Akira  <akr@f...>
 
 	* test/lib/minitest/unit.rb: Check tempfile leak for each test class.
Index: test/lib/minitest/unit.rb
===================================================================
--- test/lib/minitest/unit.rb	(revision 46117)
+++ test/lib/minitest/unit.rb	(revision 46118)
@@ -130,11 +130,16 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/test/lib/minitest/unit.rb#L130
       return "Expected: #{mu_pp exp}\n  Actual: #{mu_pp act}" unless
         need_to_diff
 
+      tempfile_a = nil
+      tempfile_b = nil
+
       Tempfile.open("expect") do |a|
+        tempfile_a = a
         a.puts expect
         a.flush
 
         Tempfile.open("butwas") do |b|
+          tempfile_b = b
           b.puts butwas
           b.flush
 
@@ -155,6 +160,9 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/test/lib/minitest/unit.rb#L160
       end
 
       result
+    ensure
+      tempfile_a.close! if tempfile_a
+      tempfile_b.close! if tempfile_b
     end
 
     ##

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

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