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

ruby-changes:18185

From: usa <ko1@a...>
Date: Tue, 14 Dec 2010 15:06:27 +0900 (JST)
Subject: [ruby-changes:18185] Ruby:r30206 (trunk): * test/ruby/test_io.rb (test_reopen, test_reinitialize): should close

usa	2010-12-14 15:06:18 +0900 (Tue, 14 Dec 2010)

  New Revision: 30206

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

  Log:
    * test/ruby/test_io.rb (test_reopen, test_reinitialize): should close
      the temporay files.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_io.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30205)
+++ ChangeLog	(revision 30206)
@@ -1,3 +1,8 @@
+Tue Dec 14 15:03:46 2010  NAKAMURA Usaku  <usa@r...>
+
+	* test/ruby/test_io.rb (test_reopen, test_reinitialize): should close
+	  the temporay files.
+
 Tue Dec 14 14:24:15 2010  NAKAMURA Usaku  <usa@r...>
 
 	* test/ruby/test_io.rb (make_tempfile): change the prefix from 'foo'
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 30205)
+++ test/ruby/test_io.rb	(revision 30206)
@@ -1417,20 +1417,28 @@
     open(__FILE__) do |f|
       f.gets
       f2 = open(t.path)
-      f2.gets
-      assert_nothing_raised {
-        f.reopen(f2)
-        assert_equal("bar\n", f.gets, '[ruby-core:24240]')
-      }
+      begin
+        f2.gets
+        assert_nothing_raised {
+          f.reopen(f2)
+          assert_equal("bar\n", f.gets, '[ruby-core:24240]')
+        }
+      ensure
+        f2.close
+      end
     end
 
     open(__FILE__) do |f|
       f2 = open(t.path)
-      f.reopen(f2)
-      assert_equal("foo\n", f.gets)
-      assert_equal("bar\n", f.gets)
-      f.reopen(f2)
-      assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
+      begin
+        f.reopen(f2)
+        assert_equal("foo\n", f.gets)
+        assert_equal("bar\n", f.gets)
+        f.reopen(f2)
+        assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
+      ensure
+        f2.close
+      end
     end
   end
 
@@ -1587,8 +1595,12 @@
   def test_reinitialize
     t = make_tempfile
     f = open(t.path)
-    assert_raise(RuntimeError) do
-      f.instance_eval { initialize }
+    begin
+      assert_raise(RuntimeError) do
+        f.instance_eval { initialize }
+      end
+    ensure
+      f.close
     end
   end
 

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

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