summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-25 14:16:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-25 14:16:02 +0000
commit8559c4c125c6b01549cff9f7ba1eaed9aebf48b2 (patch)
treea9ef7ac56426252889738a0dcfc8459bd4470033
parent198964ea2f65c9f5b2e9afe8f5a7c27a03d7671e (diff)
* test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove
tempfiles. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/lib/minitest/unit.rb8
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 29c9ff9599..c2094967cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun May 25 23:02:06 2014 Tanaka Akira <akr@fsij.org>
+
+ * test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove
+ tempfiles.
+
Sun May 25 22:42:27 2014 Tanaka Akira <akr@fsij.org>
* test/lib/minitest/unit.rb: Check tempfile leak for each test class.
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index c51baf7cf8..7fdbc4b291 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -130,11 +130,16 @@ module MiniTest
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
end
result
+ ensure
+ tempfile_a.close! if tempfile_a
+ tempfile_b.close! if tempfile_b
end
##