aboutsummaryrefslogtreecommitdiffstats
path: root/test/lib/test/unit/assertions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/test/unit/assertions.rb')
-rw-r--r--test/lib/test/unit/assertions.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index 727c54c9d5..6c36c4e8c5 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -442,6 +442,28 @@ EOT
assert(failed.empty?, message(m) {failed.pretty_inspect})
end
+ class AllFailures
+ attr_reader :failures
+
+ def initialize
+ @failures = {}
+ end
+
+ def for(key)
+ yield
+ rescue Exception => e
+ @failures[key] = e
+ end
+ end
+
+ def all_assertions(msg = nil)
+ all = AllFailures.new
+ yield all
+ ensure
+ failures = all.failures
+ assert(failures.empty?, message(msg) {mu_pp(failures)})
+ end
+
def build_message(head, template=nil, *arguments) #:nodoc:
template &&= template.chomp
template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) }