From 9faa910961511e9154abe9464bc4a1c848c5bed9 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 16 Mar 2012 08:38:18 +0000 Subject: Tempfile#open * test/ruby/test_exception.rb (test_systemexit_new, test_exception_in_exception_equal): use Tempfile#open. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index a44aef892b..f0d7d0fe07 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -367,15 +367,17 @@ end.join def test_exception_in_name_error_to_str bug5575 = '[ruby-core:41612]' - t = Tempfile.new(["test_exception_in_name_error_to_str", ".rb"]) - t.puts <<-EOC + t = nil + Tempfile.open(["test_exception_in_name_error_to_str", ".rb"]) do |f| + t = f + t.puts <<-EOC begin BasicObject.new.inspect rescue $!.inspect end EOC - t.close + end assert_nothing_raised(NameError, bug5575) do load(t.path) end @@ -391,14 +393,16 @@ end.join def test_exception_in_exception_equal bug5865 = '[ruby-core:41979]' - t = Tempfile.new(["test_exception_in_exception_equal", ".rb"]) - t.puts <<-EOC + t = nil + Tempfile.open(["test_exception_in_exception_equal", ".rb"]) do |f| + t = f + t.puts <<-EOC o = Object.new def o.exception(arg) end RuntimeError.new("a") == o EOC - t.close + end assert_nothing_raised(ArgumentError, bug5865) do load(t.path) end -- cgit v1.2.3