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

ruby-changes:10379

From: akr <ko1@a...>
Date: Sat, 31 Jan 2009 22:52:00 +0900 (JST)
Subject: [ruby-changes:10379] Ruby:r21923 (trunk): * lib/test/unit/assertions.rb (assert_equal): show class in failure

akr	2009-01-31 22:51:46 +0900 (Sat, 31 Jan 2009)

  New Revision: 21923

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

  Log:
    * lib/test/unit/assertions.rb (assert_equal): show class in failure
      message if meaningful.

  Modified files:
    trunk/ChangeLog
    trunk/lib/test/unit/assertions.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21922)
+++ ChangeLog	(revision 21923)
@@ -1,3 +1,8 @@
+Sat Jan 31 22:50:38 2009  Tanaka Akira  <akr@f...>
+
+	* lib/test/unit/assertions.rb (assert_equal): show class in failure
+	  message if meaningful.
+
 Sat Jan 31 22:38:46 2009  Tanaka Akira  <akr@f...>
 
 	* lib/resolv.rb (Resolv::DNS#each_address): don't query IPv6 address
Index: lib/test/unit/assertions.rb
===================================================================
--- lib/test/unit/assertions.rb	(revision 21922)
+++ lib/test/unit/assertions.rb	(revision 21923)
@@ -69,6 +69,10 @@
             elsif exp.is_a?(Time) && act.is_a?(Time)
               exp_comment = " (nsec=#{exp.nsec})"
               act_comment = " (nsec=#{act.nsec})"
+            elsif exp.class != act.class
+              # a subclass of Range, for example.
+              exp_comment = " (#{exp.class})"
+              act_comment = " (#{act.class})"
             end
           elsif !Encoding.compatible?(exp_str, act_str)
             if exp.is_a?(String) && act.is_a?(String)

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

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