diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_exception.rb | 16 |
1 files changed, 10 insertions, 6 deletions
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 |