mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Some initial work on formatters
This commit is contained in:
parent
31d819e4c9
commit
d7bc376429
2 changed files with 21 additions and 24 deletions
|
@ -1,27 +1,8 @@
|
|||
require "../reporters"
|
||||
|
||||
module Spectator::Formatting
|
||||
# Interface for reporting test progress and results.
|
||||
#
|
||||
# The methods should be called in this order:
|
||||
# 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)
|
||||
abstract class Formatter < Reporters::Reporter
|
||||
def initialize(@output : IO)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
16
src/spectator/formatting/progress_formatter.cr
Normal file
16
src/spectator/formatting/progress_formatter.cr
Normal 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
|
Loading…
Reference in a new issue