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

ruby-changes:23512

From: naruse <ko1@a...>
Date: Mon, 7 May 2012 18:08:52 +0900 (JST)
Subject: [ruby-changes:23512] naruse:r35563 (trunk): * lib/minitest/unit.rb (assert_match): replace matcher only if both

naruse	2012-05-07 18:08:17 +0900 (Mon, 07 May 2012)

  New Revision: 35563

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

  Log:
    * lib/minitest/unit.rb (assert_match): replace matcher only if both
      matcher and obj are String. fix r35541. [Bug #6405]
      DON'T COMMIT IF YOU CAN'T RUN TEST.
      FIX AS SOON AS POSSIBLE YOU BREAK TESTS.
      patched by ayumin.
      https://github.com/seattlerb/minitest/pull/124
    
    * lib/minitest/unit.rb (refute_match): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/minitest/unit.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35562)
+++ ChangeLog	(revision 35563)
@@ -1,3 +1,14 @@
+Mon May  7 17:54:12 2012  NARUSE, Yui  <naruse@r...>
+
+	* lib/minitest/unit.rb (assert_match): replace matcher only if both
+	  matcher and obj are String. fix r35541. [Bug #6405]
+	  DON'T COMMIT IF YOU CAN'T RUN TEST.
+	  FIX AS SOON AS POSSIBLE YOU BREAK TESTS.
+	  patched by ayumin.
+	  https://github.com/seattlerb/minitest/pull/124
+
+	* lib/minitest/unit.rb (refute_match): ditto.
+
 Mon May  7 13:41:00 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* Makefile.in (PROGRAM), configure.in (POSTLINK): sign built program
Index: lib/minitest/unit.rb
===================================================================
--- lib/minitest/unit.rb	(revision 35562)
+++ lib/minitest/unit.rb	(revision 35563)
@@ -281,8 +281,8 @@
 
     def assert_match matcher, obj, msg = nil
       msg = message(msg) { "Expected #{mu_pp matcher} to match #{mu_pp obj}" }
-      assert_respond_to matcher, :"=~"
-      matcher = Regexp.new Regexp.escape matcher if String === matcher
+      assert_respond_to obj, :"=~"
+      matcher = Regexp.new Regexp.escape matcher if String === matcher and String === obj
       assert matcher =~ obj, msg
     end
 
@@ -582,8 +582,8 @@
 
     def refute_match matcher, obj, msg = nil
       msg = message(msg) {"Expected #{mu_pp matcher} to not match #{mu_pp obj}"}
-      assert_respond_to matcher, :"=~"
-      matcher = Regexp.new Regexp.escape matcher if String === matcher
+      assert_respond_to obj, :"=~"
+      matcher = Regexp.new Regexp.escape matcher if String === matcher and String === obj
       refute matcher =~ obj, msg
     end
 

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

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