mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Handle nodes with no name
This commit is contained in:
parent
4a44d038fb
commit
6d8d117ec2
1 changed files with 10 additions and 4 deletions
|
@ -12,6 +12,9 @@ module Spectator::Formatting
|
||||||
# Identation string.
|
# Identation string.
|
||||||
private INDENT = " "
|
private INDENT = " "
|
||||||
|
|
||||||
|
# String used for groups and examples that don't have a name.
|
||||||
|
private NO_NAME = "<anonymous>"
|
||||||
|
|
||||||
# Output stream to write results to.
|
# Output stream to write results to.
|
||||||
private getter io
|
private getter io
|
||||||
|
|
||||||
|
@ -34,19 +37,22 @@ module Spectator::Formatting
|
||||||
# Invoked after an example completes successfully.
|
# Invoked after an example completes successfully.
|
||||||
# Produces a successful example line.
|
# Produces a successful example line.
|
||||||
def example_passed(notification)
|
def example_passed(notification)
|
||||||
line(notification.example.name.colorize(:green))
|
name = (notification.example.name? || NO_NAME)
|
||||||
|
line(name.colorize(:green))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Invoked after an example is skipped or marked as pending.
|
# Invoked after an example is skipped or marked as pending.
|
||||||
# Produces a pending example line.
|
# Produces a pending example line.
|
||||||
def example_pending(notification)
|
def example_pending(notification)
|
||||||
line(notification.example.name.colorize(:yellow))
|
name = (notification.example.name? || NO_NAME)
|
||||||
|
line(name.colorize(:yellow))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Invoked after an example fails.
|
# Invoked after an example fails.
|
||||||
# Produces a failure example line.
|
# Produces a failure example line.
|
||||||
def example_failed(notification)
|
def example_failed(notification)
|
||||||
line(notification.example.name.colorize(:red))
|
name = (notification.example.name? || NO_NAME)
|
||||||
|
line(name.colorize(:red))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Invoked after an example fails from an unexpected error.
|
# Invoked after an example fails from an unexpected error.
|
||||||
|
@ -60,7 +66,7 @@ module Spectator::Formatting
|
||||||
Array(Label).new.tap do |hierarchy|
|
Array(Label).new.tap do |hierarchy|
|
||||||
group = example.group?
|
group = example.group?
|
||||||
while group && (parent = group.group?)
|
while group && (parent = group.group?)
|
||||||
hierarchy << group.name
|
hierarchy << (group.name? || NO_NAME)
|
||||||
group = parent
|
group = parent
|
||||||
end
|
end
|
||||||
hierarchy.reverse!
|
hierarchy.reverse!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue