diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-07 02:19:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-07 02:19:59 +0000 |
commit | 2b450de096df474ca92948dd4e9dc1db7d3d5bc7 (patch) | |
tree | e946e33300b67628137b3059f911b595e5489472 /test | |
parent | 9c56ac3fdccad32c223aa183560da453e4d436c4 (diff) | |
download | ruby-2b450de096df474ca92948dd4e9dc1db7d3d5bc7.tar.gz |
assertions.rb: refine all_assertions
* test/lib/test/unit/assertions.rb (all_assertions): refine
total failiure message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/test/unit/assertions.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb index 6c36c4e8c5..a317a850fd 100644 --- a/test/lib/test/unit/assertions.rb +++ b/test/lib/test/unit/assertions.rb @@ -454,14 +454,24 @@ EOT rescue Exception => e @failures[key] = e end + + def message + i = 0 + @failures.map {|k, v| + "\n#{i+=1}. Assertion for #{k.inspect}\n#{v.message.gsub(/^/, ' | ')}" + }.join("\n") + end + + def pass? + @failures.empty? + end end def all_assertions(msg = nil) all = AllFailures.new yield all ensure - failures = all.failures - assert(failures.empty?, message(msg) {mu_pp(failures)}) + assert(all.pass?, message(msg) {all.message}) end def build_message(head, template=nil, *arguments) #:nodoc: |