[前][次][番号順一覧][スレッド一覧]

ruby-changes:2272

From: ko1@a...
Date: 24 Oct 2007 15:20:42 +0900
Subject: [ruby-changes:2272] akr - Ruby:r13763 (trunk): use Dir.mktmpdir.

akr	2007-10-24 15:20:31 +0900 (Wed, 24 Oct 2007)

  New Revision: 13763

  Modified files:
    trunk/test/dbm/test_dbm.rb
    trunk/test/gdbm/test_gdbm.rb
    trunk/test/sdbm/test_sdbm.rb

  Log:
    use Dir.mktmpdir.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/dbm/test_dbm.rb?r1=13763&r2=13762
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/gdbm/test_gdbm.rb?r1=13763&r2=13762
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/sdbm/test_sdbm.rb?r1=13763&r2=13762

Index: test/sdbm/test_sdbm.rb
===================================================================
--- test/sdbm/test_sdbm.rb	(revision 13762)
+++ test/sdbm/test_sdbm.rb	(revision 13763)
@@ -8,7 +8,7 @@
 
 class TestSDBM < Test::Unit::TestCase
   def setup
-    @tmpdir = Dir.tmpdir
+    @tmpdir = Dir.mktmpdir("tmptest_sdbm")
     @prefix = "tmptest_sdbm_#{$$}"
     @path = "#{@tmpdir}/#{@prefix}_"
     assert_instance_of(SDBM, @sdbm = SDBM.new(@path))
@@ -18,8 +18,7 @@
     ObjectSpace.each_object(SDBM) do |obj|
       obj.close unless obj.closed?
     end
-    File.delete *Dir.glob("#{@tmpdir}/#{@prefix}*").to_a
-    p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
+    FileUtils.remove_entry_secure @tmpdir
   end
 
   def check_size(expect, sdbm=@sdbm)
Index: test/dbm/test_dbm.rb
===================================================================
--- test/dbm/test_dbm.rb	(revision 13762)
+++ test/dbm/test_dbm.rb	(revision 13763)
@@ -28,7 +28,7 @@
     SYSTEM = uname_s
 
     def setup
-      @tmpdir = Dir.tmpdir
+      @tmpdir = Dir.mktmpdir("tmptest_dbm")
       @prefix = "tmptest_dbm_#{$$}"
       @path = "#{@tmpdir}/#{@prefix}_"
       assert_instance_of(DBM, @dbm = DBM.new(@path))
@@ -48,8 +48,7 @@
       ObjectSpace.each_object(DBM) do |obj|
         obj.close unless obj.closed?
       end
-      File.delete *Dir.glob("#{@tmpdir}/#{@prefix}*").to_a
-      p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
+      FileUtils.remove_entry_secure @tmpdir
     end
 
     def check_size(expect, dbm=@dbm)
Index: test/gdbm/test_gdbm.rb
===================================================================
--- test/gdbm/test_gdbm.rb	(revision 13762)
+++ test/gdbm/test_gdbm.rb	(revision 13763)
@@ -28,7 +28,7 @@
     SYSTEM = uname_s
 
     def setup
-      @tmpdir = Dir.tmpdir
+      @tmpdir = Dir.mktmpdir("tmptest_gdbm")
       @prefix = "tmptest_gdbm_#{$$}"
       @path = "#{@tmpdir}/#{@prefix}_"
       assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
@@ -45,8 +45,7 @@
       ObjectSpace.each_object(GDBM) do |obj|
         obj.close unless obj.closed?
       end
-      File.delete *Dir.glob("#{@tmpdir}/#{@prefix}*").to_a
-      p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
+      FileUtils.remove_entry_secure @tmpdir
     end
 
     def check_size(expect, gdbm=@gdbm)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]