mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove ExampleGroup#all_examples
Implement the same functionality with ExampleIterator.
This commit is contained in:
parent
b5a18ad324
commit
6c882f9cae
3 changed files with 5 additions and 15 deletions
|
@ -50,19 +50,6 @@ module Spectator
|
|||
end
|
||||
end
|
||||
|
||||
# TODO: Remove this method.
|
||||
def all_examples
|
||||
Array(Example).new(example_count).tap do |array|
|
||||
children.each do |child|
|
||||
if child.is_a?(Example)
|
||||
array << child
|
||||
else
|
||||
array.concat(child.as(ExampleGroup).all_examples)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def finished? : Bool
|
||||
children.all?(&.finished?)
|
||||
end
|
||||
|
|
|
@ -33,3 +33,5 @@ require "./successful_result"
|
|||
require "./pending_result"
|
||||
require "./failed_result"
|
||||
require "./errored_result"
|
||||
|
||||
require "./example_iterator"
|
||||
|
|
|
@ -5,15 +5,16 @@ module Spectator
|
|||
end
|
||||
|
||||
def run : Nil
|
||||
iterator = ExampleIterator.new(@group)
|
||||
results = [] of Result
|
||||
elapsed = Time.measure do
|
||||
@formatter.start_suite
|
||||
results = @group.all_examples.map do |example|
|
||||
results = iterator.map do |example|
|
||||
@formatter.start_example(example)
|
||||
Internals::Harness.run(example).tap do |result|
|
||||
@formatter.end_example(result)
|
||||
end.as(Result)
|
||||
end
|
||||
end.to_a
|
||||
end
|
||||
@formatter.end_suite(TestResults.new(results, elapsed))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue