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

ruby-changes:34062

From: nobu <ko1@a...>
Date: Mon, 26 May 2014 22:33:12 +0900 (JST)
Subject: [ruby-changes:34062] nobu:r46143 (trunk): test/rdoc: avoid tempfile leaks

nobu	2014-05-26 22:33:06 +0900 (Mon, 26 May 2014)

  New Revision: 46143

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

  Log:
    test/rdoc: avoid tempfile leaks
    
    * test/rdoc/test_rdoc_parser.rb (test_class_for_forbidden): avoid
      tempfile leaks by using `Tempfile.create` instead of
      `Tempfile.open`.
    * test/rdoc/test_rdoc_rd_block_parser.rb (test_parse_include_subtree):
      ditto.
    * test/rdoc/test_rdoc_rdoc.rb (test_parse_file_encoding): ditto.
    * test/rdoc/test_rdoc_rdoc.rb (test_parse_file_forbidden): ditto.

  Modified files:
    trunk/test/rdoc/test_rdoc_parser.rb
    trunk/test/rdoc/test_rdoc_rd_block_parser.rb
    trunk/test/rdoc/test_rdoc_rdoc.rb
Index: test/rdoc/test_rdoc_rdoc.rb
===================================================================
--- test/rdoc/test_rdoc_rdoc.rb	(revision 46142)
+++ test/rdoc/test_rdoc_rdoc.rb	(revision 46143)
@@ -252,7 +252,7 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L252
     @rdoc.options.encoding = Encoding::ISO_8859_1
     @rdoc.store = RDoc::Store.new
 
-    Tempfile.open 'test.txt' do |io|
+    Tempfile.create 'test.txt' do |io|
       io.write 'hi'
       io.rewind
 
@@ -267,7 +267,7 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L267
 
     @rdoc.store = RDoc::Store.new
 
-    Tempfile.open 'test.txt' do |io|
+    Tempfile.create 'test.txt' do |io|
       io.write 'hi'
       io.rewind
 
@@ -382,7 +382,7 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L382
   end
 
   def test_setup_output_dir_exists_file
-    Tempfile.open 'test_rdoc_rdoc' do |tempfile|
+    Tempfile.create 'test_rdoc_rdoc' do |tempfile|
       path = tempfile.path
 
       e = assert_raises RDoc::Error do
Index: test/rdoc/test_rdoc_rd_block_parser.rb
===================================================================
--- test/rdoc/test_rdoc_rd_block_parser.rb	(revision 46142)
+++ test/rdoc/test_rdoc_rd_block_parser.rb	(revision 46143)
@@ -153,7 +153,7 @@ class TestRDocRdBlockParser < RDoc::Test https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rd_block_parser.rb#L153
         blank_line,
         blank_line)
 
-    Tempfile.open %w[parse_include .rd] do |io|
+    Tempfile.create %w[parse_include .rd] do |io|
       io.puts "=begin\ninclude ((*worked*))\n=end"
       io.flush
 
Index: test/rdoc/test_rdoc_parser.rb
===================================================================
--- test/rdoc/test_rdoc_parser.rb	(revision 46142)
+++ test/rdoc/test_rdoc_parser.rb	(revision 46143)
@@ -96,7 +96,7 @@ class TestRDocParser < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser.rb#L96
   def test_class_for_forbidden
     skip 'chmod not supported' if Gem.win_platform?
 
-    Tempfile.open 'forbidden' do |io|
+    Tempfile.create 'forbidden' do |io|
       begin
         File.chmod 0000, io.path
         forbidden = @store.add_file io.path

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

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