summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 08:38:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 08:38:18 +0000
commit9faa910961511e9154abe9464bc4a1c848c5bed9 (patch)
tree6fbdef671e2159294eeda42349171a8455a2c302 /test/ruby
parent62cdd6e64a946ab40a83a5017330cca2fde70099 (diff)
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_exception.rb16
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