mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Short-hand syntax for blocks with yield
This commit is contained in:
parent
d670d96045
commit
4948fe0c6f
3 changed files with 7 additions and 7 deletions
|
@ -17,11 +17,11 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
def examples : Enumerable(Example)
|
def examples : Enumerable(Example)
|
||||||
children.compact_map { |child| child.as?(Example) }
|
children.compact_map &.as?(Example)
|
||||||
end
|
end
|
||||||
|
|
||||||
def groups : Enumerable(ExampleGroup)
|
def groups : Enumerable(ExampleGroup)
|
||||||
children.compact_map { |child| child.as?(ExampleGroup) }
|
children.compact_map &.as?(ExampleGroup)
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_count
|
def example_count
|
||||||
|
|
|
@ -20,19 +20,19 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_before_all
|
def run_before_all
|
||||||
@before_all.each(&.call)
|
@before_all.each &.call
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_before_each
|
def run_before_each
|
||||||
@before_each.each(&.call)
|
@before_each.each &.call
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_after_all
|
def run_after_all
|
||||||
@after_all.each(&.call)
|
@after_all.each &.call
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_after_each
|
def run_after_each
|
||||||
@after_each.each(&.call)
|
@after_each.each &.call
|
||||||
end
|
end
|
||||||
|
|
||||||
def wrap_around_each(&block : ->)
|
def wrap_around_each(&block : ->)
|
||||||
|
|
|
@ -37,7 +37,7 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_runtime
|
def example_runtime
|
||||||
@results.map { |result| result.elapsed }.sum
|
@results.map(&.elapsed).sum
|
||||||
end
|
end
|
||||||
|
|
||||||
def overhead_time
|
def overhead_time
|
||||||
|
|
Loading…
Reference in a new issue