mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
7382eb7e38
commit
1e1a114c25
1 changed files with 3 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue