summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-20 01:43:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-20 01:43:45 +0000
commit1da4d51bf93ec9d202b992d6214cba437c229b7c (patch)
tree1c14159a995648221331b2b6e8f4fda42550bb30 /test/lib
parent50ec15d676e578f49e35bf4a6bbd9faeb2c2bcff (diff)
assertions.rb: show failed indexes
* test/lib/test/unit/assertions.rb (AllFailures): show indexes in total number of failure assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/test/unit/assertions.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index c749384..8eb8057 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -785,19 +785,23 @@ eom
attr_reader :failures
def initialize
+ @count = 0
@failures = {}
end
def for(key)
+ @count += 1
yield
rescue Exception => e
- @failures[key] = e
+ @failures[key] = [@count, e]
end
def message
i = 0
- @failures.map {|k, v|
- "\n#{i+=1}. Assertion for #{k.inspect}\n#{v.message.gsub(/^/, ' | ')}"
+ total = @count.to_s
+ fmt = "%#{total.size}d"
+ @failures.map {|k, (n, v)|
+ "\n#{i+=1}. [#{fmt%n}/#{total}] Assertion for #{k.inspect}\n#{v.message.gsub(/^/, ' | ')}"
}.join("\n")
end