mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
use Dir.mktmpdir.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
124bdf8815
commit
5d2671d2bc
3 changed files with 23 additions and 27 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue