mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
6c882f9cae
Implement the same functionality with ExampleIterator.
22 lines
649 B
Crystal
22 lines
649 B
Crystal
module Spectator
|
|
class Runner
|
|
def initialize(@group : ExampleGroup,
|
|
@formatter : Formatters::Formatter = Formatters::DefaultFormatter.new)
|
|
end
|
|
|
|
def run : Nil
|
|
iterator = ExampleIterator.new(@group)
|
|
results = [] of Result
|
|
elapsed = Time.measure do
|
|
@formatter.start_suite
|
|
results = iterator.map do |example|
|
|
@formatter.start_example(example)
|
|
Internals::Harness.run(example).tap do |result|
|
|
@formatter.end_example(result)
|
|
end.as(Result)
|
|
end.to_a
|
|
end
|
|
@formatter.end_suite(TestResults.new(results, elapsed))
|
|
end
|
|
end
|
|
end
|