diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-25 09:53:49 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-25 09:53:49 +0000 |
| commit | 80519f7e49d830ba024930cd96dd7eddbf0528da (patch) | |
| tree | cc8ce8faabbbb27b5a631c221da9489ed75106a8 | |
| parent | bbe7b6596aea6ef37e6e27d80e6185855124bac9 (diff) | |
| download | ruby-80519f7e49d830ba024930cd96dd7eddbf0528da.tar.gz ruby-80519f7e49d830ba024930cd96dd7eddbf0528da.tar.xz ruby-80519f7e49d830ba024930cd96dd7eddbf0528da.zip | |
merges r20943 from trunk into ruby_1_9_1.
* lib/test/unit/assertions.rb (assert_equal): show small differences
for Regexp and Float.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/test/unit/assertions.rb | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Tue Dec 23 17:38:03 2008 Tanaka Akira <akr@fsij.org> + + * lib/test/unit/assertions.rb (assert_equal): show small differences + for Regexp and Float. + Tue Dec 23 16:49:48 2008 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (rb_w32_spawn): support normal commands with arguments. diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index af1a23a3b..0a31915bd 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})" |
