mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8606377de4
commit
71a1a3b8c5
1 changed files with 13 additions and 3 deletions
|
@ -17,10 +17,14 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
|
|||
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::Package::TarTestCase
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue