1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-26 14:36:22 +00:00
parent c11f98eddc
commit f14b11f2e6
4 changed files with 19 additions and 1 deletions

View file

@ -31,6 +31,8 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase
new_header = Gem::Package::TarHeader.from io new_header = Gem::Package::TarHeader.from io
assert_headers_equal @tar_header, new_header assert_headers_equal @tar_header, new_header
ensure
io.close!
end end
def test_initialize def test_initialize

View file

@ -20,6 +20,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
end end
assert_equal 2, entries assert_equal 2, entries
ensure
io.close!
end end
def test_rewind def test_rewind
@ -30,7 +32,9 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
content + "\0" * (512 - content.size) content + "\0" * (512 - content.size)
str << "\0" * 1024 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 3.times do
tar_reader.rewind tar_reader.rewind
i = 0 i = 0
@ -41,6 +45,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
assert_equal(1, i) assert_equal(1, i)
end end
end end
ensure
io.close!
end end
def test_seek def test_seek
@ -58,6 +64,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
assert_equal 0, io.pos assert_equal 0, io.pos
end end
ensure
io.close!
end end
def test_seek_missing def test_seek_missing
@ -73,6 +81,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
assert_equal 0, io.pos assert_equal 0, io.pos
end end
ensure
io.close!
end end
end end

View file

@ -16,6 +16,11 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
@entry = util_entry @tar @entry = util_entry @tar
end end
def teardown
@entry.instance_variable_get(:@io).close!
super
end
def test_bytes_read def test_bytes_read
assert_equal 0, @entry.bytes_read assert_equal 0, @entry.bytes_read

View file

@ -14,6 +14,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def teardown def teardown
@tar_writer.close unless @tar_writer.closed? @tar_writer.close unless @tar_writer.closed?
@io.close!
super super
end end