summaryrefslogtreecommitdiff
path: root/tool/lib/minitest
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-09-09 20:52:48 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-09-09 21:10:48 +0900
commitb194973dcd5eda6c9e256029ea39dc532ae18962 (patch)
tree30ebee5b13e2c3511ab3a41fc6219a779d89ad8f /tool/lib/minitest
parent6997109fcaef0567f176e53dfc092aecc49f9ece (diff)
Revert the related commits about `Tempfile.open` change.
Start with https://github.com/ruby/ruby/commit/fa21985a7a2f8f52a8bd82bd12a724e9dca74934 to https://github.com/ruby/ruby/commit/d7492a0be885ea9f2b9f71e3e95582f9a859c439
Diffstat (limited to 'tool/lib/minitest')
-rw-r--r--tool/lib/minitest/unit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb
index 9066782322..c325134e63 100644
--- a/tool/lib/minitest/unit.rb
+++ b/tool/lib/minitest/unit.rb
@@ -122,11 +122,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
@@ -147,6 +152,9 @@ module MiniTest
end
result
+ ensure
+ tempfile_a.close! if tempfile_a
+ tempfile_b.close! if tempfile_b
end
##