mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Mostly implemented progress formatter
This commit is contained in:
parent
e2f4051927
commit
eebcba0749
1 changed files with 30 additions and 1 deletions
|
@ -1,8 +1,37 @@
|
|||
require "colorize"
|
||||
require "./formatter"
|
||||
|
||||
module Spectator::Formatting
|
||||
# Output formatter that produces a single character for each test as it completes.
|
||||
# A '.' indicates a pass, 'F' a failure, and '*' a skipped or pending test.
|
||||
# A '.' indicates a pass, 'F' a failure, 'E' an error, and '*' a skipped or pending test.
|
||||
class ProgressFormatter < Formatter
|
||||
@pass_char : Colorize::Object(Char) = '.'.colorize(:green)
|
||||
@fail_char : Colorize::Object(Char) = 'F'.colorize(:red)
|
||||
@error_char : Colorize::Object(Char) = 'E'.colorize(:red)
|
||||
@skip_char : Colorize::Object(Char) = '*'.colorize(:yellow)
|
||||
|
||||
# Creates the formatter.
|
||||
def initialize(@io : IO = STDOUT)
|
||||
end
|
||||
|
||||
# Produces a pass character.
|
||||
def example_passed(_notification)
|
||||
@pass_char.to_s(@io)
|
||||
end
|
||||
|
||||
# Produces a fail character.
|
||||
def example_failed(_notification)
|
||||
@fail_char.to_s(@io)
|
||||
end
|
||||
|
||||
# Produces an error character.
|
||||
def example_error(_notification)
|
||||
@error_char.to_s(@io)
|
||||
end
|
||||
|
||||
# Produces a skip character.
|
||||
def example_pending(_notification)
|
||||
@skip_char.to_s(@io)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue