diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-16 14:24:08 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-16 14:24:08 +0000 |
commit | fc8ad5d6255e32040aba72b6d756996510b2ba6a (patch) | |
tree | 6f883159ec5ca9263982913375b2f3ed80305d9c /lib/test | |
parent | d51d07a81326b007a509eb5fd9e8529daba645c5 (diff) | |
download | ruby-fc8ad5d6255e32040aba72b6d756996510b2ba6a.tar.gz ruby-fc8ad5d6255e32040aba72b6d756996510b2ba6a.tar.xz ruby-fc8ad5d6255e32040aba72b6d756996510b2ba6a.zip |
* lib/test/unit.rb (assert_equal): failure message changed.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test')
-rw-r--r-- | lib/test/unit.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/test/unit.rb b/lib/test/unit.rb index 329e451d4..fddc994e6 100644 --- a/lib/test/unit.rb +++ b/lib/test/unit.rb @@ -89,7 +89,22 @@ module Test end def assert_equal(exp, act, msg = nil) - msg = message(msg) { "Expected\n<#{mu_pp(exp)}> but\n<#{mu_pp(act)}>" } + msg = message(msg) { + exp_str = mu_pp(exp) + act_str = mu_pp(act) + exp_comment = '' + act_comment = '' + if exp_str == act_str + if exp.is_a?(String) && act.is_a?(String) + exp_comment = " (#{exp.encoding})" + act_comment = " (#{act.encoding})" + elsif exp.is_a?(Time) && act.is_a?(Time) + exp_comment = " (nsec=#{exp.nsec})" + act_comment = " (nsec=#{act.nsec})" + end + end + "<#{exp_str}>#{exp_comment} expected but was\n<#{act_str}>#{act_comment}" + } assert(exp == act, msg) end |