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

ruby-changes:37493

From: nobu <ko1@a...>
Date: Thu, 12 Feb 2015 11:47:38 +0900 (JST)
Subject: [ruby-changes:37493] nobu:r49574 (trunk): drbtest.rb: refactor

nobu	2015-02-12 11:47:29 +0900 (Thu, 12 Feb 2015)

  New Revision: 49574

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

  Log:
    drbtest.rb: refactor
    
    * test/drb/drbtest.rb (test_07_public_private_protected_missing):
      refactor by splitting and using assert_raise.

  Modified files:
    trunk/test/drb/drbtest.rb
Index: test/drb/drbtest.rb
===================================================================
--- test/drb/drbtest.rb	(revision 49573)
+++ test/drb/drbtest.rb	(revision 49574)
@@ -197,38 +197,33 @@ module DRbCore https://github.com/ruby/ruby/blob/trunk/test/drb/drbtest.rb#L197
     end
   end
 
-  def test_07_public_private_protected_missing
-    assert_nothing_raised() {
-      begin
-	@there.method_missing(:eval, 'nil')
-      rescue NoMethodError
-	assert_match(/^private method \`eval\'/, $!.message)
-      end
+  def test_07_private_missing
+    e = assert_raise(NoMethodError) {
+      @there.method_missing(:eval, 'nil')
     }
-    assert_nothing_raised() {
-      begin
-        @there.call_private_method
-      rescue NoMethodError
-        assert_equal(NoMethodError, $!.class)
-	assert_match(/^private method \`call_private_method\'/, $!.message)
-      end
+    assert_match(/^private method \`eval\'/, e.message)
+
+    e = assert_raise(NoMethodError) {
+      @there.call_private_method
     }
-    assert_nothing_raised() {
-      begin
-        @there.call_protected_method
-      rescue NoMethodError
-        assert_equal(NoMethodError, $!.class)
-	assert_match(/^protected method \`call_protected_method\'/, $!.message)
-      end
+    assert_match(/^private method \`call_private_method\'/, e.message)
+  end
+
+  def test_07_protected_missing
+    e = assert_raise(NoMethodError) {
+      @there.call_protected_method
     }
-    assert_nothing_raised() {
-      begin
-	@there.method_missing(:undefined_method_test)
-      rescue NoMethodError
-        assert_equal(NoMethodError, $!.class)
-	assert_match(/^undefined method \`undefined_method_test\'/, $!.message)
-      end
+    assert_match(/^protected method \`call_protected_method\'/, e.message)
+  end
+
+  def test_07_public_missing
+    e = assert_raise(NoMethodError) {
+      @there.method_missing(:undefined_method_test)
     }
+    assert_match(/^undefined method \`undefined_method_test\'/, e.message)
+  end
+
+  def test_07_send_missing
     assert_raise(DRb::DRbConnError) do
       @there.method_missing(:__send__, :to_s)
     end

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

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