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
This commit is contained in:
parent
9c56ac3fdc
commit
2b450de096
@ -454,14 +454,24 @@ EOT
|
|||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
@failures[key] = e
|
@failures[key] = e
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def all_assertions(msg = nil)
|
def all_assertions(msg = nil)
|
||||||
all = AllFailures.new
|
all = AllFailures.new
|
||||||
yield all
|
yield all
|
||||||
ensure
|
ensure
|
||||||
failures = all.failures
|
assert(all.pass?, message(msg) {all.message})
|
||||||
assert(failures.empty?, message(msg) {mu_pp(failures)})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_message(head, template=nil, *arguments) #:nodoc:
|
def build_message(head, template=nil, *arguments) #:nodoc:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user