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

ruby-changes:9648

From: ryan <ko1@a...>
Date: Tue, 30 Dec 2008 18:26:45 +0900 (JST)
Subject: [ruby-changes:9648] Ruby:r21188 (trunk): Imported minitest 1.3.1 r4506.

ryan	2008-12-30 18:26:27 +0900 (Tue, 30 Dec 2008)

  New Revision: 21188

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

  Log:
    Imported minitest 1.3.1 r4506.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21187)
+++ ChangeLog	(revision 21188)
@@ -1,3 +1,8 @@
+Tue Dec 30 18:23:10 2008  Ryan Davis  <ryand-ruby@z...>
+
+	* lib/minitest/*.rb: Imported minitest 1.3.1 r4506.
+	* test/minitest/*.rb: ditto.
+
 Tue Dec 30 17:59:59 2008  Martin Duerst  <duerst@i...>
 
 	* transcode.c: Minor fixes and tweaks in documentation.
@@ -231,7 +236,7 @@
 	* thread.c (mutex_unlock, rb_mutex_unlock, rb_mutex_unlock_all):
 	  mutex_unlock receives a thread.
 
-Sun Dec 28 05:44:44 2008  Ryan Davis  <ryan@w...>
+Sun Dec 28 05:44:44 2008  Ryan Davis  <ryand-ruby@z...>
 
 	* lib/minitest/*.rb: Imported minitest 1.3.1 r4505.
 	* test/minitest/*.rb: ditto.
@@ -4032,7 +4037,7 @@
 	* ext/json/ext/parser/parser.c (JSON_parse_string):
 	  associate encoding.
 
-Fri Oct 10 10:18:21 2008  Ryan Davis  <ryan@w...>
+Fri Oct 10 10:18:21 2008  Ryan Davis  <ryand-ruby@z...>
 
 	* lib/test/*: reverted back to test/unit.
 	* test/test/*: ditto
@@ -13426,7 +13431,7 @@
 	  miniruby, and tests, debug, etc have no meaning when
 	  cross-compiling.
 
-Tue Jun 17 18:39:11 2008  Ryan Davis  <ryan@w...>
+Tue Jun 17 18:39:11 2008  Ryan Davis  <ryand-ruby@z...>
 
 	* common.mk: fixed dependencies on miniruby.
 
Index: lib/minitest/unit.rb
===================================================================
--- lib/minitest/unit.rb	(revision 21187)
+++ lib/minitest/unit.rb	(revision 21188)
@@ -119,7 +119,7 @@
       msg = message(msg) { "Expected #{mu_pp(exp)} to match #{mu_pp(act)}" }
       assert_respond_to act, :"=~"
       exp = /#{Regexp.escape(exp)}/ if String === exp && String === act
-      assert act =~ exp, msg
+      assert exp =~ act, msg
     end
 
     def assert_nil obj, msg = nil
@@ -283,7 +283,7 @@
       msg = message(msg) { "Expected #{mu_pp(exp)} to not match #{mu_pp(act)}" }
       assert_respond_to act, :"=~"
       exp = /#{Regexp.escape(exp)}/ if String === exp && String === act
-      refute act =~ exp, msg
+      refute exp =~ act, msg
     end
 
     def refute_nil obj, msg = nil
Index: test/minitest/test_mini_test.rb
===================================================================
--- test/minitest/test_mini_test.rb	(revision 21187)
+++ test/minitest/test_mini_test.rb	(revision 21188)
@@ -535,6 +535,27 @@
     @tc.assert_match(/\w+/, "blah blah blah")
   end
 
+  def test_assert_match_object
+    @assertion_count = 2
+
+    pattern = Object.new
+    def pattern.=~(other) true end
+
+    @tc.assert_match pattern, 5
+  end
+
+  def test_assert_match_object_triggered
+    @assertion_count = 2
+
+    pattern = Object.new
+    def pattern.=~(other) false end
+    def pattern.inspect; "<<Object>>" end
+
+    util_assert_triggered 'Expected <<Object>> to match 5.' do
+      @tc.assert_match pattern, 5
+    end
+  end
+
   def test_assert_match_triggered
     @assertion_count = 2
     util_assert_triggered 'Expected /\d+/ to match "blah blah blah".' do
@@ -866,6 +887,35 @@
     @tc.refute_match(/\d+/, "blah blah blah")
   end
 
+  def test_refute_match_object
+    @assertion_count = 2
+    @tc.refute_match Object.new, 5 # default #=~ returns false
+  end
+
+  def test_assert_object_triggered
+    @assertion_count = 2
+
+    pattern = Object.new
+    def pattern.=~(other) false end
+    def pattern.inspect; "<<Object>>" end
+
+    util_assert_triggered 'Expected <<Object>> to match 5.' do
+      @tc.assert_match pattern, 5
+    end
+  end
+
+  def test_refute_match_object_triggered
+    @assertion_count = 2
+
+    pattern = Object.new
+    def pattern.=~(other) true end
+    def pattern.inspect; "<<Object>>" end
+
+    util_assert_triggered 'Expected <<Object>> to not match 5.' do
+      @tc.refute_match pattern, 5
+    end
+  end
+
   def test_refute_match_triggered
     @assertion_count = 2
     util_assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do

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

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