Object
Collects and reports the result of all runs.
Did this run pass?
# File lib/minitest.rb, line 413 def passed? results.all?(&:skipped?) end
Record a result and output the Runnable#result_code. Stores the result of the run if the run did not pass.
# File lib/minitest.rb, line 449 def record result self.count += 1 self.assertions += result.assertions io.print "%s#%s = %.2f s = " % [result.class, result.name, result.time] if options[:verbose] io.print result.result_code io.puts if options[:verbose] results << result if not result.passed? or result.skipped? end
Outputs the summary of the run.
# File lib/minitest.rb, line 464 def report aggregate = results.group_by { |r| r.failure.class } aggregate.default = [] # dumb. group_by should provide this f = aggregate[Assertion].size e = aggregate[UnexpectedError].size s = aggregate[Skip].size t = Time.now - start_time io.puts # finish the dots io.puts io.puts "Finished in %.6fs, %.4f runs/s, %.4f assertions/s." % [t, count / t, self.assertions / t] format = "%d runs, %d assertions, %d failures, %d errors, %d skips" summary = format % [count, self.assertions, f, e, s] io.print self io.puts io.puts summary end
Top-level method to ensure that start and report are called. Yields to the caller.
# File lib/minitest.rb, line 421 def run_and_report start yield io.sync = self.old_sync if self.sync report end
Starts reporting on the run.
# File lib/minitest.rb, line 433 def start self.sync = io.respond_to? :"sync=" # stupid emacs self.old_sync, io.sync = io.sync, true if self.sync self.start_time = Time.now io.puts "Run options: #{options[:args]}" io.puts io.puts "# Running:" io.puts end
Generated with the Darkfish Rdoc Generator 2.