ruby-changes:44136
From: nobu <ko1@a...>
Date: Fri, 23 Sep 2016 14:27:44 +0900 (JST)
Subject: [ruby-changes:44136] nobu:r56209 (trunk): test_fileutils.rb: use Dir.mktmpdir
nobu 2016-09-23 14:27:38 +0900 (Fri, 23 Sep 2016) New Revision: 56209 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56209 Log: test_fileutils.rb: use Dir.mktmpdir * test/fileutils/test_fileutils.rb: use Dir.mktmpdir instead of fixed name for temporary directory. Modified files: trunk/test/fileutils/test_fileutils.rb Index: test/fileutils/test_fileutils.rb =================================================================== --- test/fileutils/test_fileutils.rb (revision 56208) +++ test/fileutils/test_fileutils.rb (revision 56209) @@ -9,7 +9,6 @@ require 'tmpdir' https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L9 require 'test/unit' class TestFileUtils < Test::Unit::TestCase - TMPROOT = "#{Dir.tmpdir}/fileutils.rb.#{$$}" include Test::Unit::FileAssertions def assert_output_lines(expected, fu = self, message=nil) @@ -96,8 +95,7 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L95 end begin - tmproot = TMPROOT - Dir.mkdir tmproot unless File.directory?(tmproot) + tmproot = Dir.mktmpdir "fileutils" Dir.chdir tmproot do Dir.mkdir("\n") Dir.rmdir("\n") @@ -145,8 +143,7 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L143 def setup @prevdir = Dir.pwd @groups = Process.groups if have_file_perm? - tmproot = TMPROOT - mymkdir tmproot unless File.directory?(tmproot) + tmproot = @tmproot = Dir.mktmpdir "fileutils" Dir.chdir tmproot my_rm_rf 'data'; mymkdir 'data' my_rm_rf 'tmp'; mymkdir 'tmp' @@ -155,7 +152,7 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L152 def teardown Dir.chdir @prevdir - my_rm_rf TMPROOT + my_rm_rf @tmproot end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/