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 | 338253cbe54569137cff26f6cb5dd6db379f481b (patch) | |
tree | 6f883159ec5ca9263982913375b2f3ed80305d9c /lib | |
parent | 0ebf9b176380e691d3505e6c96cb0e33c6d892e4 (diff) | |
download | ruby-338253cbe54569137cff26f6cb5dd6db379f481b.tar.gz |
* lib/test/unit.rb (assert_equal): failure message changed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-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 329e451d4f..fddc994e64 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 |