ruby-changes:24394
From: akr <ko1@a...>
Date: Wed, 18 Jul 2012 22:01:41 +0900 (JST)
Subject: [ruby-changes:24394] akr:r36445 (trunk): * test/ruby/test_argf.rb: use temporally directory.
akr 2012-07-18 22:00:57 +0900 (Wed, 18 Jul 2012) New Revision: 36445 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36445 Log: * test/ruby/test_argf.rb: use temporally directory. Modified files: trunk/ChangeLog trunk/test/ruby/test_argf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36444) +++ ChangeLog (revision 36445) @@ -1,3 +1,7 @@ +Wed Jul 18 21:59:46 2012 Tanaka Akira <akr@f...> + + * test/ruby/test_argf.rb: use temporally directory. + Wed Jul 18 19:41:19 2012 Tanaka Akira <akr@f...> * test/openssl/test_config.rb: remove temporally files early. Index: test/ruby/test_argf.rb =================================================================== --- test/ruby/test_argf.rb (revision 36444) +++ test/ruby/test_argf.rb (revision 36445) @@ -2,43 +2,44 @@ require 'timeout' require 'tmpdir' require 'tempfile' +require 'fileutils' require_relative 'envutil' class TestArgf < Test::Unit::TestCase def setup - @t1 = Tempfile.new("argf-foo") + @tmpdir = Dir.mktmpdir + @tmp_count = 0 + @t1 = make_tempfile0("argf-foo") @t1.binmode @t1.puts "1" @t1.puts "2" @t1.close - @t2 = Tempfile.new("argf-bar") + @t2 = make_tempfile0("argf-bar") @t2.binmode @t2.puts "3" @t2.puts "4" @t2.close - @t3 = Tempfile.new("argf-baz") + @t3 = make_tempfile0("argf-baz") @t3.binmode @t3.puts "5" @t3.puts "6" @t3.close - @tmps = [@t1, @t2, @t3] end def teardown - @tmps.each {|t| - bak = t.path + ".bak" - File.unlink bak if File.file? bak - t.close(true) - } + FileUtils.rmtree(@tmpdir) end + def make_tempfile0(basename) + open("#{@tmpdir}/#{basename}-#{@tmp_count}", "w") + end + def make_tempfile - t = Tempfile.new("argf-qux") + t = make_tempfile0("argf-qux") t.puts "foo" t.puts "bar" t.puts "baz" t.close - @tmps << t t end @@ -417,11 +418,11 @@ end end - t1 = Tempfile.new("argf-foo") + t1 = open("#{@tmpdir}/argf-hoge", "w") t1.binmode t1.puts "foo" t1.close - t2 = Tempfile.new("argf-bar") + t2 = open("#{@tmpdir}/argf-moge", "w") t2.binmode t2.puts "bar" t2.close -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/