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

ruby-changes:34064

From: nobu <ko1@a...>
Date: Mon, 26 May 2014 23:36:42 +0900 (JST)
Subject: [ruby-changes:34064] nobu:r46145 (trunk): test/rdoc: avoid tempfile leaks

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

  New Revision: 46145

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

  Log:
    test/rdoc: avoid tempfile leaks
    
    * test/rubygems/test_gem_package.rb: avoid tempfile leaks by using
      `Tempfile.create` instead of `Tempfile.open`.
    * test/rubygems/test_gem_request_set.rb: ditto.
    * test/rubygems/test_gem_request_set_gem_dependency_api.rb: ditto.

  Modified files:
    trunk/test/rubygems/test_gem_package.rb
    trunk/test/rubygems/test_gem_request_set.rb
    trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb
Index: test/rubygems/test_gem_package.rb
===================================================================
--- test/rubygems/test_gem_package.rb	(revision 46144)
+++ test/rubygems/test_gem_package.rb	(revision 46145)
@@ -621,7 +621,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L621
   end
 
   def test_verify_corrupt
-    Tempfile.open 'corrupt' do |io|
+    Tempfile.create 'corrupt' do |io|
       data = Gem.gzip 'a' * 10
       io.write \
         tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now)
Index: test/rubygems/test_gem_request_set.rb
===================================================================
--- test/rubygems/test_gem_request_set.rb	(revision 46144)
+++ test/rubygems/test_gem_request_set.rb	(revision 46145)
@@ -156,7 +156,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set.rb#L156
   def test_load_gemdeps
     rs = Gem::RequestSet.new
 
-    Tempfile.open 'gem.deps.rb' do |io|
+    Tempfile.create 'gem.deps.rb' do |io|
       io.puts 'gem "a"'
       io.flush
 
@@ -172,7 +172,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set.rb#L172
   def test_load_gemdeps_without_groups
     rs = Gem::RequestSet.new
 
-    Tempfile.open 'gem.deps.rb' do |io|
+    Tempfile.create 'gem.deps.rb' do |io|
       io.puts 'gem "a", :group => :test'
       io.flush
 
@@ -202,7 +202,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set.rb#L202
 
     rs = Gem::RequestSet.new
 
-    Tempfile.open 'gem.deps.rb' do |io|
+    Tempfile.create 'gem.deps.rb' do |io|
       io.puts <<-gems_deps_rb
         gem "#{name}", :git => "#{repository}"
       gems_deps_rb
@@ -263,7 +263,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set.rb#L263
 
     rs = Gem::RequestSet.new
 
-    Tempfile.open 'gem.deps.rb' do |io|
+    Tempfile.create 'gem.deps.rb' do |io|
       io.puts <<-gems_deps_rb
         gem "#{a_name}", :path => "#{a_directory}"
         gem "#{b_name}", :path => "#{b_directory}"
Index: test/rubygems/test_gem_request_set_gem_dependency_api.rb
===================================================================
--- test/rubygems/test_gem_request_set_gem_dependency_api.rb	(revision 46144)
+++ test/rubygems/test_gem_request_set_gem_dependency_api.rb	(revision 46145)
@@ -492,7 +492,7 @@ class TestGemRequestSetGemDependencyAPI https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L492
   end
 
   def test_load
-    Tempfile.open 'gem.deps.rb' do |io|
+    Tempfile.create 'gem.deps.rb' do |io|
       io.write <<-GEM_DEPS
 gem 'a'
 

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

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