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
|
||||||
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
|
def finished? : Bool
|
||||||
children.all?(&.finished?)
|
children.all?(&.finished?)
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,3 +33,5 @@ require "./successful_result"
|
||||||
require "./pending_result"
|
require "./pending_result"
|
||||||
require "./failed_result"
|
require "./failed_result"
|
||||||
require "./errored_result"
|
require "./errored_result"
|
||||||
|
|
||||||
|
require "./example_iterator"
|
||||||
|
|
|
@ -5,15 +5,16 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
def run : Nil
|
def run : Nil
|
||||||
|
iterator = ExampleIterator.new(@group)
|
||||||
results = [] of Result
|
results = [] of Result
|
||||||
elapsed = Time.measure do
|
elapsed = Time.measure do
|
||||||
@formatter.start_suite
|
@formatter.start_suite
|
||||||
results = @group.all_examples.map do |example|
|
results = iterator.map do |example|
|
||||||
@formatter.start_example(example)
|
@formatter.start_example(example)
|
||||||
Internals::Harness.run(example).tap do |result|
|
Internals::Harness.run(example).tap do |result|
|
||||||
@formatter.end_example(result)
|
@formatter.end_example(result)
|
||||||
end.as(Result)
|
end.as(Result)
|
||||||
end
|
end.to_a
|
||||||
end
|
end
|
||||||
@formatter.end_suite(TestResults.new(results, elapsed))
|
@formatter.end_suite(TestResults.new(results, elapsed))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue