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

* test/rubygems/test_gem_package.rb: avoid tempfile leaks using Tempfile#close!

* test/rubygems/test_gem_request_set.rb: ditto.
* test/rubygems/test_gem_request_set_gem_dependency_api.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2014-07-04 01:09:27 +00:00
parent fb38b907b5
commit ae15655030
4 changed files with 24 additions and 6 deletions

View file

@ -1,3 +1,9 @@
Fri Jul 4 10:08:24 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* test/rubygems/test_gem_package.rb: avoid tempfile leaks using Tempfile#close!
* test/rubygems/test_gem_request_set.rb: ditto.
* test/rubygems/test_gem_request_set_gem_dependency_api.rb: ditto.
Fri Jul 4 04:42:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
* lib/net/htp/response.rb (Net::Inflater#inflate_adapter):

View file

@ -621,7 +621,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_verify_corrupt
Tempfile.open 'corrupt' do |io|
tf = Tempfile.open 'corrupt' do |io|
data = Gem.gzip 'a' * 10
io.write \
tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now)
@ -636,7 +636,9 @@ class TestGemPackage < Gem::Package::TarTestCase
assert_equal "tar is corrupt, name contains null byte in #{io.path}",
e.message
io
end
tf.close!
end
def test_verify_empty

View file

@ -156,12 +156,14 @@ DEPENDENCIES
def test_load_gemdeps
rs = Gem::RequestSet.new
Tempfile.open 'gem.deps.rb' do |io|
tf = Tempfile.open 'gem.deps.rb' do |io|
io.puts 'gem "a"'
io.flush
rs.load_gemdeps io.path
io
end
tf.close!
assert_equal [dep('a')], rs.dependencies
@ -172,12 +174,14 @@ DEPENDENCIES
def test_load_gemdeps_without_groups
rs = Gem::RequestSet.new
Tempfile.open 'gem.deps.rb' do |io|
tf = Tempfile.open 'gem.deps.rb' do |io|
io.puts 'gem "a", :group => :test'
io.flush
rs.load_gemdeps io.path, [:test]
io
end
tf.close!
assert_empty rs.dependencies
end
@ -202,7 +206,7 @@ DEPENDENCIES
rs = Gem::RequestSet.new
Tempfile.open 'gem.deps.rb' do |io|
tf = Tempfile.open 'gem.deps.rb' do |io|
io.puts <<-gems_deps_rb
gem "#{name}", :git => "#{repository}"
gems_deps_rb
@ -210,7 +214,9 @@ DEPENDENCIES
io.flush
rs.load_gemdeps io.path
io
end
tf.close!
res = rs.resolve
assert_equal 1, res.size
@ -263,7 +269,7 @@ DEPENDENCIES
rs = Gem::RequestSet.new
Tempfile.open 'gem.deps.rb' do |io|
tf = Tempfile.open 'gem.deps.rb' do |io|
io.puts <<-gems_deps_rb
gem "#{a_name}", :path => "#{a_directory}"
gem "#{b_name}", :path => "#{b_directory}"
@ -272,7 +278,9 @@ DEPENDENCIES
io.flush
rs.load_gemdeps io.path
io
end
tf.close!
res = rs.resolve
assert_equal 2, res.size

View file

@ -492,7 +492,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_load
Tempfile.open 'gem.deps.rb' do |io|
tf = Tempfile.open 'gem.deps.rb' do |io|
io.write <<-GEM_DEPS
gem 'a'
@ -507,7 +507,9 @@ end
gda.load
assert_equal [dep('a'), dep('b')], @set.dependencies
io
end
tf.close!
end
def test_name_typo