From 0c8fdb2c40a2b9aac59e3f0cdc8fe66245984f90 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 24 Oct 2007 05:55:26 +0000 Subject: use Dir.mktmpdir. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_dir.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'test/ruby/test_dir.rb') diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index 164f13f71..e3a24e858 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -5,25 +5,23 @@ require 'fileutils' class TestDir < Test::Unit::TestCase - ROOT = File.join(Dir.tmpdir, "__test_dir__#{$$}") - def setup - Dir.mkdir(ROOT) + @root = Dir.mktmpdir for i in ?a..?z if i.ord % 2 == 0 - FileUtils.touch(File.join(ROOT, i)) + FileUtils.touch(File.join(@root, i)) else - FileUtils.mkdir(File.join(ROOT, i)) + FileUtils.mkdir(File.join(@root, i)) end end end def teardown - FileUtils.rm_rf ROOT if File.directory?(ROOT) + FileUtils.remove_entry_secure @root if File.directory?(@root) end def test_seek - dir = Dir.open(ROOT) + dir = Dir.open(@root) begin cache = [] loop do -- cgit