mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Allow output to be printed to other streams
This commit is contained in:
parent
2012db85c5
commit
e8ca350152
1 changed files with 9 additions and 4 deletions
|
@ -22,6 +22,11 @@ module Spectator::Formatters
|
||||||
# Character output for a pending or skipped example.
|
# Character output for a pending or skipped example.
|
||||||
PENDING_CHAR = '*'
|
PENDING_CHAR = '*'
|
||||||
|
|
||||||
|
# Creates the formatter.
|
||||||
|
# By default, output is sent to `STDOUT`.
|
||||||
|
def initialize(@io : IO = STDOUT)
|
||||||
|
end
|
||||||
|
|
||||||
# Does nothing when an example is started.
|
# Does nothing when an example is started.
|
||||||
def start_example(example)
|
def start_example(example)
|
||||||
# ...
|
# ...
|
||||||
|
@ -31,13 +36,13 @@ module Spectator::Formatters
|
||||||
def end_example(result)
|
def end_example(result)
|
||||||
case result
|
case result
|
||||||
when ErroredResult
|
when ErroredResult
|
||||||
print error(ERROR_CHAR)
|
@io.print error(ERROR_CHAR)
|
||||||
when PendingResult
|
when PendingResult
|
||||||
print pending(PENDING_CHAR)
|
@io.print pending(PENDING_CHAR)
|
||||||
when SuccessfulResult
|
when SuccessfulResult
|
||||||
print success(SUCCESS_CHAR)
|
@io.print success(SUCCESS_CHAR)
|
||||||
else # FailedResult
|
else # FailedResult
|
||||||
print failure(FAILURE_CHAR)
|
@io.print failure(FAILURE_CHAR)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue