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

ruby-changes:22418

From: naruse <ko1@a...>
Date: Wed, 8 Feb 2012 09:46:39 +0900 (JST)
Subject: [ruby-changes:22418] naruse:r34467 (ruby_1_9_3): merge revision(s) 33673:

naruse	2012-02-08 09:46:28 +0900 (Wed, 08 Feb 2012)

  New Revision: 34467

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34467

  Log:
    merge revision(s) 33673:
    
    * test/dbm/test_dbm.rb: split tests for read only database.
    
    * test/gdbm/test_gdbm.rb: ditto.

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/test/dbm/test_dbm.rb
    branches/ruby_1_9_3/test/gdbm/test_gdbm.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 34466)
+++ ruby_1_9_3/ChangeLog	(revision 34467)
@@ -1,3 +1,9 @@
+Wed Feb  8 09:45:23 2012  Tanaka Akira  <akr@f...>
+
+	* test/dbm/test_dbm.rb: split tests for read only database.
+
+	* test/gdbm/test_gdbm.rb: ditto.
+
 Wed Feb  8 09:43:48 2012  CHIKANAGA Tomoyuki  <nagachika00@g...>
 
 	* error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 34466)
+++ ruby_1_9_3/version.h	(revision 34467)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 52
+#define RUBY_PATCHLEVEL 53
 
 #define RUBY_RELEASE_DATE "2012-02-08"
 #define RUBY_RELEASE_YEAR 2012
Index: ruby_1_9_3/test/dbm/test_dbm.rb
===================================================================
--- ruby_1_9_3/test/dbm/test_dbm.rb	(revision 34466)
+++ ruby_1_9_3/test/dbm/test_dbm.rb	(revision 34467)
@@ -10,8 +10,8 @@
   require 'tmpdir'
   require 'fileutils'
 
-  class TestDBM < Test::Unit::TestCase
-    def TestDBM.uname_s
+  class TestDBM_RDONLY < Test::Unit::TestCase
+    def TestDBM_RDONLY.uname_s
       require 'rbconfig'
       case RbConfig::CONFIG['target_os']
       when 'cygwin'
@@ -31,7 +31,6 @@
       @tmpdir = Dir.mktmpdir("tmptest_dbm")
       @prefix = "tmptest_dbm_#{$$}"
       @path = "#{@tmpdir}/#{@prefix}_"
-      assert_instance_of(DBM, @dbm = DBM.new(@path))
 
       # prepare to make readonly DBM file
       DBM.open("#{@tmpdir}/#{@prefix}_rdonly") {|dbm|
@@ -43,7 +42,6 @@
       assert_instance_of(DBM, @dbm_rdonly = DBM.new("#{@tmpdir}/#{@prefix}_rdonly", nil))
     end
     def teardown
-      assert_nil(@dbm.close)
       assert_nil(@dbm_rdonly.close)
       ObjectSpace.each_object(DBM) do |obj|
         obj.close unless obj.closed?
@@ -51,6 +49,32 @@
       FileUtils.remove_entry_secure @tmpdir
     end
 
+    def test_delete_rdonly
+      if /^CYGWIN_9/ !~ SYSTEM
+        assert_raise(DBMError) {
+          @dbm_rdonly.delete("foo")
+        }
+
+        assert_nil(@dbm_rdonly.delete("bar"))
+      end
+    end
+  end
+
+  class TestDBM < Test::Unit::TestCase
+    def setup
+      @tmpdir = Dir.mktmpdir("tmptest_dbm")
+      @prefix = "tmptest_dbm_#{$$}"
+      @path = "#{@tmpdir}/#{@prefix}_"
+      assert_instance_of(DBM, @dbm = DBM.new(@path))
+    end
+    def teardown
+      assert_nil(@dbm.close)
+      ObjectSpace.each_object(DBM) do |obj|
+        obj.close unless obj.closed?
+      end
+      FileUtils.remove_entry_secure @tmpdir
+    end
+
     def check_size(expect, dbm=@dbm)
       assert_equal(expect, dbm.size)
       n = 0
@@ -325,15 +349,8 @@
       assert_equal(2, @dbm.size)
 
       assert_nil(@dbm.delete(key))
+    end
 
-      if /^CYGWIN_9/ !~ SYSTEM
-        assert_raise(DBMError) {
-          @dbm_rdonly.delete("foo")
-        }
-
-        assert_nil(@dbm_rdonly.delete("bar"))
-      end
-    end
     def test_delete_with_block
       key = 'no called block'
       @dbm[key] = 'foo'
Index: ruby_1_9_3/test/gdbm/test_gdbm.rb
===================================================================
--- ruby_1_9_3/test/gdbm/test_gdbm.rb	(revision 34466)
+++ ruby_1_9_3/test/gdbm/test_gdbm.rb	(revision 34467)
@@ -10,8 +10,8 @@
   require 'tmpdir'
   require 'fileutils'
 
-  class TestGDBM < Test::Unit::TestCase
-    def TestGDBM.uname_s
+  class TestGDBM_RDONLY < Test::Unit::TestCase
+    def TestGDBM_RDONLY.uname_s
       require 'rbconfig'
       case RbConfig::CONFIG['target_os']
       when 'cygwin'
@@ -31,7 +31,6 @@
       @tmpdir = Dir.mktmpdir("tmptest_gdbm")
       @prefix = "tmptest_gdbm_#{$$}"
       @path = "#{@tmpdir}/#{@prefix}_"
-      assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
 
       # prepare to make readonly GDBM file
       GDBM.open("#{@tmpdir}/#{@prefix}_rdonly", 0400) {|gdbm|
@@ -40,7 +39,6 @@
       assert_instance_of(GDBM, @gdbm_rdonly = GDBM.new("#{@tmpdir}/#{@prefix}_rdonly", nil))
     end
     def teardown
-      assert_nil(@gdbm.close)
       assert_nil(@gdbm_rdonly.close)
       ObjectSpace.each_object(GDBM) do |obj|
         obj.close unless obj.closed?
@@ -48,6 +46,34 @@
       FileUtils.remove_entry_secure @tmpdir
     end
 
+    def test_delete_rdonly
+      if /^CYGWIN_9/ !~ SYSTEM
+        assert_raise(GDBMError) {
+          @gdbm_rdonly.delete("foo")
+        }
+
+        assert_nil(@gdbm_rdonly.delete("bar"))
+      end
+    end
+  end
+
+  class TestGDBM < Test::Unit::TestCase
+    SYSTEM = TestGDBM_RDONLY::SYSTEM
+
+    def setup
+      @tmpdir = Dir.mktmpdir("tmptest_gdbm")
+      @prefix = "tmptest_gdbm_#{$$}"
+      @path = "#{@tmpdir}/#{@prefix}_"
+      assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
+    end
+    def teardown
+      assert_nil(@gdbm.close)
+      ObjectSpace.each_object(GDBM) do |obj|
+        obj.close unless obj.closed?
+      end
+      FileUtils.remove_entry_secure @tmpdir
+    end
+
     def check_size(expect, gdbm=@gdbm)
       assert_equal(expect, gdbm.size)
       n = 0
@@ -438,15 +464,8 @@
       assert_equal(2, @gdbm.size)
 
       assert_nil(@gdbm.delete(key))
+    end
 
-      if /^CYGWIN_9/ !~ SYSTEM
-        assert_raise(GDBMError) {
-          @gdbm_rdonly.delete("foo")
-        }
-
-        assert_nil(@gdbm_rdonly.delete("bar"))
-      end
-    end
     def test_delete_with_block
       key = 'no called block'
       @gdbm[key] = 'foo'

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

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