From 1e1a114c256686be6b65793699c0e43d9fc8c84b Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 23 Sep 2016 05:27:38 +0000 Subject: [PATCH] test_fileutils.rb: use Dir.mktmpdir * test/fileutils/test_fileutils.rb: use Dir.mktmpdir instead of fixed name for temporary directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/fileutils/test_fileutils.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 63a4590cf0..00441a4cfb 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -9,7 +9,6 @@ require 'tmpdir' 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::TestCase 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::TestCase 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::TestCase def teardown Dir.chdir @prevdir - my_rm_rf TMPROOT + my_rm_rf @tmproot end