From ace35ac66c3df9beec76bbff7c75b37307930678 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 23 Dec 2008 09:34:08 +0000 Subject: * lib/test/unit/assertions.rb (assert_equal): show small differences for Regexp and Float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/test/unit/assertions.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/test') diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index af1a23a3bc..0a31915bd9 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -53,9 +53,13 @@ module Test 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})" -- cgit v1.2.3