ruby-changes:2273
From: ko1@a...
Date: 24 Oct 2007 15:30:19 +0900
Subject: [ruby-changes:2273] akr - Ruby:r13764 (trunk): forgot to modify TestDBM2 and TestGDBM2.
akr 2007-10-24 15:29:59 +0900 (Wed, 24 Oct 2007)
New Revision: 13764
Modified files:
trunk/test/dbm/test_dbm.rb
trunk/test/gdbm/test_gdbm.rb
Log:
forgot to modify TestDBM2 and TestGDBM2.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/dbm/test_dbm.rb?r1=13764&r2=13763
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/gdbm/test_gdbm.rb?r1=13764&r2=13763
Index: test/dbm/test_dbm.rb
===================================================================
--- test/dbm/test_dbm.rb (revision 13763)
+++ test/dbm/test_dbm.rb (revision 13764)
@@ -497,43 +497,41 @@
end
class TestDBM2 < Test::Unit::TestCase
- TMPROOT = "#{Dir.tmpdir}/ruby-dbm.#{$$}"
-
def setup
- Dir.mkdir TMPROOT, 0755
+ @tmproot = Dir.mktmpdir('ruby-dbm')
end
def teardown
- FileUtils.rm_rf TMPROOT if File.directory?(TMPROOT)
+ FileUtils.remove_entry_secure @tmproot if File.directory?(@tmproot)
end
def test_reader_open_notexist
assert_raise(Errno::ENOENT) {
- DBM.open("#{TMPROOT}/a", 0666, DBM::READER)
+ DBM.open("#{@tmproot}/a", 0666, DBM::READER)
}
end
def test_writer_open_notexist
assert_raise(Errno::ENOENT) {
- DBM.open("#{TMPROOT}/a", 0666, DBM::WRITER)
+ DBM.open("#{@tmproot}/a", 0666, DBM::WRITER)
}
end
def test_wrcreat_open_notexist
- v = DBM.open("#{TMPROOT}/a", 0666, DBM::WRCREAT)
+ v = DBM.open("#{@tmproot}/a", 0666, DBM::WRCREAT)
assert_instance_of(DBM, v)
v.close
end
def test_newdb_open_notexist
- v = DBM.open("#{TMPROOT}/a", 0666, DBM::NEWDB)
+ v = DBM.open("#{@tmproot}/a", 0666, DBM::NEWDB)
assert_instance_of(DBM, v)
v.close
end
def test_reader_open
- DBM.open("#{TMPROOT}/a") {} # create a db.
- v = DBM.open("#{TMPROOT}/a", nil, DBM::READER) {|d|
+ DBM.open("#{@tmproot}/a") {} # create a db.
+ v = DBM.open("#{@tmproot}/a", nil, DBM::READER) {|d|
# Errno::EPERM is raised on Solaris which use ndbm.
# DBMError is raised on Debian which use gdbm.
assert_raises(Errno::EPERM, DBMError) { d["k"] = "v" }
@@ -543,10 +541,10 @@
end
def test_newdb_open
- DBM.open("#{TMPROOT}/a") {|dbm|
+ DBM.open("#{@tmproot}/a") {|dbm|
dbm["k"] = "v"
}
- v = DBM.open("#{TMPROOT}/a", nil, DBM::NEWDB) {|d|
+ v = DBM.open("#{@tmproot}/a", nil, DBM::NEWDB) {|d|
assert_equal(0, d.length)
assert_nil(d["k"])
true
@@ -555,7 +553,7 @@
end
def test_freeze
- DBM.open("#{TMPROOT}/a") {|d|
+ DBM.open("#{@tmproot}/a") {|d|
d.freeze
assert_raises(RuntimeError) { d["k"] = "v" }
}
Index: test/gdbm/test_gdbm.rb
===================================================================
--- test/gdbm/test_gdbm.rb (revision 13763)
+++ test/gdbm/test_gdbm.rb (revision 13764)
@@ -652,43 +652,41 @@
end
class TestGDBM2 < Test::Unit::TestCase
- TMPROOT = "#{Dir.tmpdir}/ruby-gdbm.#{$$}"
-
def setup
- Dir.mkdir TMPROOT, 0755
+ @tmproot = Dir.mktmpdir('ruby-gdbm')
end
def teardown
- FileUtils.rm_rf TMPROOT if File.directory?(TMPROOT)
+ FileUtils.remove_entry_secure @tmproot if File.directory?(@tmproot)
end
def test_reader_open_notexist
assert_raise(Errno::ENOENT) {
- GDBM.open("#{TMPROOT}/a", 0666, GDBM::READER)
+ GDBM.open("#{@tmproot}/a", 0666, GDBM::READER)
}
end
def test_writer_open_notexist
assert_raise(Errno::ENOENT) {
- GDBM.open("#{TMPROOT}/a", 0666, GDBM::WRITER)
+ GDBM.open("#{@tmproot}/a", 0666, GDBM::WRITER)
}
end
def test_wrcreat_open_notexist
- v = GDBM.open("#{TMPROOT}/a", 0666, GDBM::WRCREAT)
+ v = GDBM.open("#{@tmproot}/a", 0666, GDBM::WRCREAT)
assert_instance_of(GDBM, v)
v.close
end
def test_newdb_open_notexist
- v = GDBM.open("#{TMPROOT}/a", 0666, GDBM::NEWDB)
+ v = GDBM.open("#{@tmproot}/a", 0666, GDBM::NEWDB)
assert_instance_of(GDBM, v)
v.close
end
def test_reader_open
- GDBM.open("#{TMPROOT}/a.dbm") {} # create a db.
- v = GDBM.open("#{TMPROOT}/a.dbm", nil, GDBM::READER) {|d|
+ GDBM.open("#{@tmproot}/a.dbm") {} # create a db.
+ v = GDBM.open("#{@tmproot}/a.dbm", nil, GDBM::READER) {|d|
assert_raises(GDBMError) { d["k"] = "v" }
true
}
@@ -696,10 +694,10 @@
end
def test_newdb_open
- GDBM.open("#{TMPROOT}/a.dbm") {|dbm|
+ GDBM.open("#{@tmproot}/a.dbm") {|dbm|
dbm["k"] = "v"
}
- v = GDBM.open("#{TMPROOT}/a.dbm", nil, GDBM::NEWDB) {|d|
+ v = GDBM.open("#{@tmproot}/a.dbm", nil, GDBM::NEWDB) {|d|
assert_equal(0, d.length)
assert_nil(d["k"])
true
@@ -708,7 +706,7 @@
end
def test_freeze
- GDBM.open("#{TMPROOT}/a.dbm") {|d|
+ GDBM.open("#{@tmproot}/a.dbm") {|d|
d.freeze
assert_raises(RuntimeError) { d["k"] = "v" }
}
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml