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@13763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0945e23b07
commit
462d4e1224
3 changed files with 6 additions and 9 deletions
|
@ -28,7 +28,7 @@ if defined? DBM
|
||||||
SYSTEM = uname_s
|
SYSTEM = uname_s
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@tmpdir = Dir.tmpdir
|
@tmpdir = Dir.mktmpdir("tmptest_dbm")
|
||||||
@prefix = "tmptest_dbm_#{$$}"
|
@prefix = "tmptest_dbm_#{$$}"
|
||||||
@path = "#{@tmpdir}/#{@prefix}_"
|
@path = "#{@tmpdir}/#{@prefix}_"
|
||||||
assert_instance_of(DBM, @dbm = DBM.new(@path))
|
assert_instance_of(DBM, @dbm = DBM.new(@path))
|
||||||
|
@ -48,8 +48,7 @@ if defined? DBM
|
||||||
ObjectSpace.each_object(DBM) do |obj|
|
ObjectSpace.each_object(DBM) do |obj|
|
||||||
obj.close unless obj.closed?
|
obj.close unless obj.closed?
|
||||||
end
|
end
|
||||||
File.delete *Dir.glob("#{@tmpdir}/#{@prefix}*").to_a
|
FileUtils.remove_entry_secure @tmpdir
|
||||||
p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_size(expect, dbm=@dbm)
|
def check_size(expect, dbm=@dbm)
|
||||||
|
|
|
@ -28,7 +28,7 @@ if defined? GDBM
|
||||||
SYSTEM = uname_s
|
SYSTEM = uname_s
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@tmpdir = Dir.tmpdir
|
@tmpdir = Dir.mktmpdir("tmptest_gdbm")
|
||||||
@prefix = "tmptest_gdbm_#{$$}"
|
@prefix = "tmptest_gdbm_#{$$}"
|
||||||
@path = "#{@tmpdir}/#{@prefix}_"
|
@path = "#{@tmpdir}/#{@prefix}_"
|
||||||
assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
|
assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
|
||||||
|
@ -45,8 +45,7 @@ if defined? GDBM
|
||||||
ObjectSpace.each_object(GDBM) do |obj|
|
ObjectSpace.each_object(GDBM) do |obj|
|
||||||
obj.close unless obj.closed?
|
obj.close unless obj.closed?
|
||||||
end
|
end
|
||||||
File.delete *Dir.glob("#{@tmpdir}/#{@prefix}*").to_a
|
FileUtils.remove_entry_secure @tmpdir
|
||||||
p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_size(expect, gdbm=@gdbm)
|
def check_size(expect, gdbm=@gdbm)
|
||||||
|
|
|
@ -8,7 +8,7 @@ end
|
||||||
|
|
||||||
class TestSDBM < Test::Unit::TestCase
|
class TestSDBM < Test::Unit::TestCase
|
||||||
def setup
|
def setup
|
||||||
@tmpdir = Dir.tmpdir
|
@tmpdir = Dir.mktmpdir("tmptest_sdbm")
|
||||||
@prefix = "tmptest_sdbm_#{$$}"
|
@prefix = "tmptest_sdbm_#{$$}"
|
||||||
@path = "#{@tmpdir}/#{@prefix}_"
|
@path = "#{@tmpdir}/#{@prefix}_"
|
||||||
assert_instance_of(SDBM, @sdbm = SDBM.new(@path))
|
assert_instance_of(SDBM, @sdbm = SDBM.new(@path))
|
||||||
|
@ -18,8 +18,7 @@ class TestSDBM < Test::Unit::TestCase
|
||||||
ObjectSpace.each_object(SDBM) do |obj|
|
ObjectSpace.each_object(SDBM) do |obj|
|
||||||
obj.close unless obj.closed?
|
obj.close unless obj.closed?
|
||||||
end
|
end
|
||||||
File.delete *Dir.glob("#{@tmpdir}/#{@prefix}*").to_a
|
FileUtils.remove_entry_secure @tmpdir
|
||||||
p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_size(expect, sdbm=@sdbm)
|
def check_size(expect, sdbm=@sdbm)
|
||||||
|
|
Loading…
Reference in a new issue