ruby-changes:9405
From: akr <ko1@a...>
Date: Tue, 23 Dec 2008 18:34:25 +0900 (JST)
Subject: [ruby-changes:9405] Ruby:r20943 (trunk): * lib/test/unit/assertions.rb (assert_equal): show small differences
akr 2008-12-23 18:34:08 +0900 (Tue, 23 Dec 2008) New Revision: 20943 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20943 Log: * lib/test/unit/assertions.rb (assert_equal): show small differences for Regexp and Float. Modified files: trunk/ChangeLog trunk/lib/test/unit/assertions.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 20942) +++ ChangeLog (revision 20943) @@ -1,3 +1,8 @@ +Tue Dec 23 17:38:03 2008 Tanaka Akira <akr@f...> + + * lib/test/unit/assertions.rb (assert_equal): show small differences + for Regexp and Float. + Tue Dec 23 16:49:48 2008 NAKAMURA Usaku <usa@r...> * win32/win32.c (rb_w32_spawn): support normal commands with arguments. Index: lib/test/unit/assertions.rb =================================================================== --- lib/test/unit/assertions.rb (revision 20942) +++ lib/test/unit/assertions.rb (revision 20943) @@ -53,9 +53,13 @@ exp_comment = '' act_comment = '' if exp_str == act_str - if exp.is_a?(String) && act.is_a?(String) + if (exp.is_a?(String) && act.is_a?(String)) || + (exp.is_a?(Regexp) && act.is_a?(Regexp)) exp_comment = " (#{exp.encoding})" act_comment = " (#{act.encoding})" + elsif exp.is_a?(Float) && act.is_a?(Float) + exp_str = "%\#.#{Float::DIG+2}g" % exp + act_str = "%\#.#{Float::DIG+2}g" % act elsif exp.is_a?(Time) && act.is_a?(Time) exp_comment = " (nsec=#{exp.nsec})" act_comment = " (nsec=#{act.nsec})" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/