diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-29 13:22:27 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-29 13:22:27 +0000 |
commit | 0eddab8404d3bd70d6542c800ff2a565b52ae8ad (patch) | |
tree | 7b941c08dbbc8df57fa71ea9c31911382a2abcd8 /lib | |
parent | ad8978fdb171a6614375b7bd873b02b909485a31 (diff) | |
download | ruby-0eddab8404d3bd70d6542c800ff2a565b52ae8ad.tar.gz |
* lib/test/unit/assertions.rb (assert_equal): use Time#subsec if nsec
is not enough to distinguish arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test/unit/assertions.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index 35348d87be..821faf5803 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -67,8 +67,16 @@ module Test 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})" + if exp.subsec * 1000_000_000 == exp.nsec + exp_comment = " (#{exp.nsec}[ns])" + else + exp_comment = " (subsec=#{exp.subsec})" + end + if act.subsec * 1000_000_000 == act.nsec + act_comment = " (#{act.nsec}[ns])" + else + act_comment = " (subsec=#{act.subsec})" + end elsif exp.class != act.class # a subclass of Range, for example. exp_comment = " (#{exp.class})" |