mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Trace hook invocation
This commit is contained in:
parent
e5cbc8d631
commit
def66acc15
3 changed files with 48 additions and 4 deletions
|
@ -15,13 +15,19 @@ module Spectator
|
|||
parent.call_once_before_all
|
||||
end
|
||||
|
||||
hooks.each(&.call)
|
||||
hooks.each do |hook|
|
||||
Log.trace { "Invoking hook #{hook}" }
|
||||
hook.call
|
||||
end
|
||||
end
|
||||
|
||||
group_event after_all do |hooks|
|
||||
Log.trace { "Processing after_all hooks" }
|
||||
|
||||
hooks.each(&.call)
|
||||
hooks.each do |hook|
|
||||
Log.trace { "Invoking hook #{hook}" }
|
||||
hook.call
|
||||
end
|
||||
|
||||
if (parent = group?)
|
||||
parent.call_once_after_all
|
||||
|
@ -35,13 +41,19 @@ module Spectator
|
|||
parent.call_before_each(example)
|
||||
end
|
||||
|
||||
hooks.each(&.call(example))
|
||||
hooks.each do |hook|
|
||||
Log.trace { "Invoking hook #{hook}" }
|
||||
hook.call(example)
|
||||
end
|
||||
end
|
||||
|
||||
example_event after_each do |hooks, example|
|
||||
Log.trace { "Processing after_each hooks" }
|
||||
|
||||
hooks.each(&.call(example))
|
||||
hooks.each do |hook|
|
||||
Log.trace { "Invoking hook #{hook}" }
|
||||
hook.call(example)
|
||||
end
|
||||
|
||||
if (parent = group?)
|
||||
parent.call_after_each(example)
|
||||
|
|
|
@ -28,5 +28,21 @@ module Spectator
|
|||
def call : Nil
|
||||
@delegate.call
|
||||
end
|
||||
|
||||
# Produces the string representation of the hook.
|
||||
# Includes the source and label if they're not nil.
|
||||
def to_s(io)
|
||||
io << "example group hook"
|
||||
|
||||
if (label = @label)
|
||||
io << ' '
|
||||
io << label
|
||||
end
|
||||
|
||||
if (source = @source)
|
||||
io << " @ "
|
||||
io << source
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,5 +30,21 @@ module Spectator
|
|||
def call(example : Example) : Nil
|
||||
@delegate.call(example)
|
||||
end
|
||||
|
||||
# Produces the string representation of the hook.
|
||||
# Includes the source and label if they're not nil.
|
||||
def to_s(io)
|
||||
io << "example hook"
|
||||
|
||||
if (label = @label)
|
||||
io << ' '
|
||||
io << label
|
||||
end
|
||||
|
||||
if (source = @source)
|
||||
io << " @ "
|
||||
io << source
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue