Some initial work on formatters

This commit is contained in:
Michael Miller 2021-05-07 20:05:00 -06:00
parent 31d819e4c9
commit d7bc376429
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436
2 changed files with 21 additions and 24 deletions

View file

@ -1,27 +1,8 @@
require "../reporters"
module Spectator::Formatting module Spectator::Formatting
# Interface for reporting test progress and results. abstract class Formatter < Reporters::Reporter
# def initialize(@output : IO)
# The methods should be called in this order: end
# 1. `#start_suite`
# 2. `#start_example`
# 3. `#end_example`
# 4. `#end_suite`
#
# Steps 2 and 3 are called for each example in the suite.
abstract class Formatter
# Called when a test suite is starting to execute.
abstract def start_suite(suite : TestSuite)
# Called when a test suite finishes.
# The results from the entire suite are provided.
# The *profile* value is not nil when profiling results should be displayed.
abstract def end_suite(report : Report, profile : Profile?)
# Called before a test starts.
abstract def start_example(example : Example)
# Called when a test finishes.
# The result of the test is available through *example*.
abstract def end_example(example : Example)
end end
end end

View file

@ -0,0 +1,16 @@
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.
class ProgressFormatter < Formatter
def pass(notification)
end
def fail(notification)
end
def pending(notification)
end
end
end