mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rename reporters to formatters
This commit is contained in:
parent
251bf5bb5e
commit
cfe1a014dd
5 changed files with 16 additions and 16 deletions
6
src/spectator/formatters.cr
Normal file
6
src/spectator/formatters.cr
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
require "./formatters/*"
|
||||||
|
|
||||||
|
module Spectator
|
||||||
|
module Formatters
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
module Spectator
|
module Spectator
|
||||||
module Reporters
|
module Formatters
|
||||||
abstract class Reporter
|
abstract class Formatter
|
||||||
abstract def start_suite
|
abstract def start_suite
|
||||||
abstract def end_suite(report : Report)
|
abstract def end_suite(report : Report)
|
||||||
abstract def start_example(example : Example)
|
abstract def start_example(example : Example)
|
|
@ -1,9 +1,9 @@
|
||||||
require "./reporter"
|
require "./formatter"
|
||||||
require "colorize"
|
require "colorize"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
module Reporters
|
module Formatters
|
||||||
class StandardReporter < Reporter
|
class StandardFormatter < Formatter
|
||||||
def start_suite
|
def start_suite
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
require "./reporters/*"
|
|
||||||
|
|
||||||
module Spectator
|
|
||||||
module Reporters
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -4,22 +4,22 @@ require "./successful_example_result"
|
||||||
module Spectator
|
module Spectator
|
||||||
class Runner
|
class Runner
|
||||||
def initialize(@group : ExampleGroup,
|
def initialize(@group : ExampleGroup,
|
||||||
@reporter : Reporters::Reporter = Reporters::StandardReporter.new)
|
@formatter : Formatters::Formatter = Formatters::StandardFormatter.new)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run : Nil
|
def run : Nil
|
||||||
results = [] of ExampleResult
|
results = [] of ExampleResult
|
||||||
elapsed = Time.measure do
|
elapsed = Time.measure do
|
||||||
@reporter.start_suite
|
@formatter.start_suite
|
||||||
results = @group.all_examples.map do |example|
|
results = @group.all_examples.map do |example|
|
||||||
@reporter.start_example(example)
|
@formatter.start_example(example)
|
||||||
example.run.tap do |result|
|
example.run.tap do |result|
|
||||||
@reporter.end_example(result)
|
@formatter.end_example(result)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
report = Report.new(results, elapsed)
|
report = Report.new(results, elapsed)
|
||||||
@reporter.end_suite(report)
|
@formatter.end_suite(report)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue