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

ruby-changes:34063

From: nobu <ko1@a...>
Date: Mon, 26 May 2014 23:36:37 +0900 (JST)
Subject: [ruby-changes:34063] nobu:r46144 (trunk): test/rubygems: remove tempfiles

nobu	2014-05-26 23:36:22 +0900 (Mon, 26 May 2014)

  New Revision: 46144

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

  Log:
    test/rubygems: remove tempfiles
    
    * test/rubygems/test_gem_package_tar_header.rb: remove tempfiles.
    * test/rubygems/test_gem_package_tar_reader.rb: ditto.
    * test/rubygems/test_gem_package_tar_reader_entry.rb (teardown):
      ditto.
    * test/rubygems/test_gem_package_tar_writer.rb (teardown): ditto.

  Modified files:
    trunk/test/rubygems/test_gem_package_tar_header.rb
    trunk/test/rubygems/test_gem_package_tar_reader.rb
    trunk/test/rubygems/test_gem_package_tar_reader_entry.rb
    trunk/test/rubygems/test_gem_package_tar_writer.rb
Index: test/rubygems/test_gem_package_tar_writer.rb
===================================================================
--- test/rubygems/test_gem_package_tar_writer.rb	(revision 46143)
+++ test/rubygems/test_gem_package_tar_writer.rb	(revision 46144)
@@ -14,6 +14,7 @@ class TestGemPackageTarWriter < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_writer.rb#L14
 
   def teardown
     @tar_writer.close unless @tar_writer.closed?
+    @io.close!
 
     super
   end
Index: test/rubygems/test_gem_package_tar_reader_entry.rb
===================================================================
--- test/rubygems/test_gem_package_tar_reader_entry.rb	(revision 46143)
+++ test/rubygems/test_gem_package_tar_reader_entry.rb	(revision 46144)
@@ -16,6 +16,11 @@ class TestGemPackageTarReaderEntry < Gem https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader_entry.rb#L16
     @entry = util_entry @tar
   end
 
+  def teardown
+    @entry.instance_variable_get(:@io).close!
+    super
+  end
+
   def test_bytes_read
     assert_equal 0, @entry.bytes_read
 
Index: test/rubygems/test_gem_package_tar_header.rb
===================================================================
--- test/rubygems/test_gem_package_tar_header.rb	(revision 46143)
+++ test/rubygems/test_gem_package_tar_header.rb	(revision 46144)
@@ -31,6 +31,8 @@ class TestGemPackageTarHeader < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_header.rb#L31
     new_header = Gem::Package::TarHeader.from io
 
     assert_headers_equal @tar_header, new_header
+  ensure
+    io.close!
   end
 
   def test_initialize
Index: test/rubygems/test_gem_package_tar_reader.rb
===================================================================
--- test/rubygems/test_gem_package_tar_reader.rb	(revision 46143)
+++ test/rubygems/test_gem_package_tar_reader.rb	(revision 46144)
@@ -20,6 +20,8 @@ class TestGemPackageTarReader < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader.rb#L20
     end
 
     assert_equal 2, entries
+  ensure
+    io.close!
   end
 
   def test_rewind
@@ -30,7 +32,9 @@ class TestGemPackageTarReader < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader.rb#L32
         content + "\0" * (512 - content.size)
     str << "\0" * 1024
 
-    Gem::Package::TarReader.new(TempIO.new(str)) do |tar_reader|
+    io = TempIO.new(str)
+
+    Gem::Package::TarReader.new(io) do |tar_reader|
       3.times do
         tar_reader.rewind
         i = 0
@@ -41,6 +45,8 @@ class TestGemPackageTarReader < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader.rb#L45
         assert_equal(1, i)
       end
     end
+  ensure
+    io.close!
   end
 
   def test_seek
@@ -58,6 +64,8 @@ class TestGemPackageTarReader < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader.rb#L64
 
       assert_equal 0, io.pos
     end
+  ensure
+    io.close!
   end
 
   def test_seek_missing
@@ -73,6 +81,8 @@ class TestGemPackageTarReader < Gem::Pac https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package_tar_reader.rb#L81
 
       assert_equal 0, io.pos
     end
+  ensure
+    io.close!
   end
 
 end

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

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