mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Display summary from default formatter
This commit is contained in:
parent
b329afffb6
commit
8e1a2e114b
2 changed files with 33 additions and 2 deletions
|
@ -9,6 +9,9 @@ module Spectator
|
||||||
|
|
||||||
def end_suite(results : TestResults)
|
def end_suite(results : TestResults)
|
||||||
puts
|
puts
|
||||||
|
puts
|
||||||
|
puts finish_time_string(results)
|
||||||
|
puts result_string(results)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_example(example : Example)
|
def start_example(example : Example)
|
||||||
|
@ -26,6 +29,22 @@ module Spectator
|
||||||
"F".colorize.red
|
"F".colorize.red
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private def finish_time_string(results)
|
||||||
|
"Finished in #{human_time(results.runtime)}"
|
||||||
|
end
|
||||||
|
|
||||||
|
private def result_string(results)
|
||||||
|
examples = results.examples
|
||||||
|
failures = results.failed_examples
|
||||||
|
errors = results.errored_examples
|
||||||
|
pending = results.pending_examples
|
||||||
|
"#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending"
|
||||||
|
end
|
||||||
|
|
||||||
|
private def human_time(span : Time::Span)
|
||||||
|
span.to_s
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,24 @@ module Spectator
|
||||||
@results = results.to_a
|
@results = results.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def examples
|
||||||
|
@results.size
|
||||||
|
end
|
||||||
|
|
||||||
def successful_examples
|
def successful_examples
|
||||||
@results.select { |result| result.successful? }
|
@results.count(&.successful?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def failed_examples
|
def failed_examples
|
||||||
@results.select { |result| result.failed? }
|
@results.count(&.failed?)
|
||||||
|
end
|
||||||
|
|
||||||
|
def errored_examples
|
||||||
|
@results.count(&.errored?)
|
||||||
|
end
|
||||||
|
|
||||||
|
def pending_examples
|
||||||
|
@results.count(&.pending?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_runtime
|
def example_runtime
|
||||||
|
|
Loading…
Reference in a new issue