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

ruby-changes:34560

From: nobu <ko1@a...>
Date: Wed, 2 Jul 2014 01:18:49 +0900 (JST)
Subject: [ruby-changes:34560] nobu:r46641 (trunk): test_gem_package_tar_reader_entry.rb: close temporary files

nobu	2014-07-02 01:18:43 +0900 (Wed, 02 Jul 2014)

  New Revision: 46641

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

  Log:
    test_gem_package_tar_reader_entry.rb: close temporary files
    
    * test/rubygems/test_gem_package_tar_reader_entry.rb (teardown):
      close temporary files under util_entry to fix leaked tempfiles.

  Modified files:
    trunk/test/rubygems/test_gem_package_tar_reader_entry.rb
Index: test/rubygems/test_gem_package_tar_reader_entry.rb
===================================================================
--- test/rubygems/test_gem_package_tar_reader_entry.rb	(revision 46640)
+++ test/rubygems/test_gem_package_tar_reader_entry.rb	(revision 46641)
@@ -17,10 +17,14 @@ class TestGemPackageTarReaderEntry < Gem https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader_entry.rb#L17
   end
 
   def teardown
-    @entry.instance_variable_get(:@io).close!
+    close_util_entry(@entry)
     super
   end
 
+  def close_util_entry(entry)
+    entry.instance_variable_get(:@io).close!
+  end
+
   def test_bytes_read
     assert_equal 0, @entry.bytes_read
 
@@ -82,12 +86,18 @@ class TestGemPackageTarReaderEntry < Gem https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader_entry.rb#L86
 
   def test_directory_eh
     assert_equal false, @entry.directory?
-    assert_equal true, util_dir_entry.directory?
+    dir_ent = util_dir_entry
+    assert_equal true, dir_ent.directory?
+  ensure
+    close_util_entry(dir_ent) if dir_ent
   end
 
   def test_file_eh
     assert_equal true, @entry.file?
-    assert_equal false, util_dir_entry.file?
+    dir_ent = util_dir_entry
+    assert_equal false, dir_ent.file?
+  ensure
+    close_util_entry(dir_ent) if dir_ent
   end
 
   def test_pos

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

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