mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement ExampleComponent#example_count
This commit is contained in:
parent
467afd053c
commit
eade6873e4
3 changed files with 10 additions and 5 deletions
|
@ -29,6 +29,11 @@ module Spectator
|
|||
def initialize(@group, sample_values : Internals::SampleValues)
|
||||
end
|
||||
|
||||
# Indicates there is only one example to run.
|
||||
def example_count
|
||||
1
|
||||
end
|
||||
|
||||
# String representation of the example.
|
||||
# This consists of the groups the example is in and the description.
|
||||
# The string can be given to end-users to identify the example.
|
||||
|
|
|
@ -7,5 +7,8 @@ module Spectator
|
|||
|
||||
# Indicates whether the example (or group) has been completely run.
|
||||
abstract def finished? : Bool
|
||||
|
||||
# The number of examples in this instance.
|
||||
abstract def example_count : Int
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,11 +27,8 @@ module Spectator
|
|||
children.each
|
||||
end
|
||||
|
||||
# TODO: Remove this method.
|
||||
def example_count
|
||||
children.sum do |child|
|
||||
child.is_a?(Example) ? 1 : child.as(ExampleGroup).example_count
|
||||
end
|
||||
def example_count : Int
|
||||
children.sum(&.example_count)
|
||||
end
|
||||
|
||||
# TODO: Remove this method.
|
||||
|
|
Loading…
Reference in a new issue