[前][次][番号順一覧][スレッド一覧]

ruby-changes:23014

From: nobu <ko1@a...>
Date: Fri, 16 Mar 2012 17:38:31 +0900 (JST)
Subject: [ruby-changes:23014] nobu:r35063 (trunk): Tempfile#open

nobu	2012-03-16 17:38:18 +0900 (Fri, 16 Mar 2012)

  New Revision: 35063

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35063

  Log:
    Tempfile#open
    
    * test/ruby/test_exception.rb (test_systemexit_new,
      test_exception_in_exception_equal): use Tempfile#open.

  Modified files:
    trunk/test/ruby/test_exception.rb

Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb	(revision 35062)
+++ test/ruby/test_exception.rb	(revision 35063)
@@ -367,15 +367,17 @@
 
   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 @@
 
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]