diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-24 06:29:59 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-24 06:29:59 +0000 |
commit | d1f87f56844f5aed054eba0e6b2403e290f33626 (patch) | |
tree | 2ad593841f0f704f84543c317ca0cf0e2278188a /test/dbm | |
parent | a97880f4f6ffe51b52946b0bcb6af44f0c598a42 (diff) | |
download | ruby-d1f87f56844f5aed054eba0e6b2403e290f33626.tar.gz ruby-d1f87f56844f5aed054eba0e6b2403e290f33626.tar.xz ruby-d1f87f56844f5aed054eba0e6b2403e290f33626.zip |
forgot to modify TestDBM2 and TestGDBM2.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dbm')
-rw-r--r-- | test/dbm/test_dbm.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb index bc48831cd..159ab43f3 100644 --- a/test/dbm/test_dbm.rb +++ b/test/dbm/test_dbm.rb @@ -497,43 +497,41 @@ if defined? DBM 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 @@ if defined? DBM 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 @@ if defined? DBM end def test_freeze - DBM.open("#{TMPROOT}/a") {|d| + DBM.open("#{@tmproot}/a") {|d| d.freeze assert_raises(RuntimeError) { d["k"] = "v" } } |