mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
WIP code for document formatter (-v)
This commit is contained in:
parent
ca92fbb29f
commit
a3c4d06e45
1 changed files with 26 additions and 0 deletions
26
src/spectator/formatting/document_formatter.cr
Normal file
26
src/spectator/formatting/document_formatter.cr
Normal file
|
@ -0,0 +1,26 @@
|
|||
require "./formatter"
|
||||
require "./suite_summary"
|
||||
|
||||
module Spectator::Formatting
|
||||
# Produces an indented document-style output.
|
||||
# Each nested group of examples increases the indent.
|
||||
# Example names are output in a color based on their result.
|
||||
class DocumentFormatter < Formatter
|
||||
include SuiteSummary
|
||||
|
||||
# Creates the formatter.
|
||||
# By default, output is sent to STDOUT.
|
||||
def initialize(@io : IO = STDOUT)
|
||||
end
|
||||
|
||||
# Does nothing when an example is started.
|
||||
def start_example(example)
|
||||
# TODO: Display group names.
|
||||
end
|
||||
|
||||
# Produces a single character output based on a result.
|
||||
def end_example(result)
|
||||
@io.puts result.call(Color) { result.example.what }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue