mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Shorten names of result classes
This commit is contained in:
parent
6ca4d8d2a6
commit
5819e0201e
13 changed files with 30 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
require "./failed_example_result"
|
||||
require "./failed_result"
|
||||
|
||||
module Spectator
|
||||
class ErroredExampleResult < FailedExampleResult
|
||||
class ErroredResult < FailedResult
|
||||
getter error : Exception
|
||||
|
||||
def errored? : Bool
|
|
@ -6,7 +6,7 @@ module Spectator
|
|||
def initialize(@group)
|
||||
end
|
||||
|
||||
abstract def run : ExampleResult
|
||||
abstract def run : Result
|
||||
abstract def description : String
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "./example_result"
|
||||
require "./result"
|
||||
|
||||
module Spectator
|
||||
class FailedExampleResult < ExampleResult
|
||||
class FailedResult < Result
|
||||
getter error : Exception
|
||||
|
||||
def passed? : Bool
|
|
@ -14,15 +14,15 @@ module Spectator
|
|||
def start_example(example : Example)
|
||||
end
|
||||
|
||||
def end_example(result : ExampleResult)
|
||||
def end_example(result : Result)
|
||||
print case result
|
||||
when SuccessfulExampleResult
|
||||
when SuccessfulResult
|
||||
".".colorize.green
|
||||
when PendingExampleResult
|
||||
when PendingResult
|
||||
"P".colorize.yellow
|
||||
when ErroredExampleResult
|
||||
when ErroredResult
|
||||
"E".colorize.magenta
|
||||
when FailedExampleResult
|
||||
when FailedResult
|
||||
"F".colorize.red
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module Spectator
|
|||
abstract def start_suite
|
||||
abstract def end_suite(report : Report)
|
||||
abstract def start_example(example : Example)
|
||||
abstract def end_example(result : ExampleResult)
|
||||
abstract def end_example(result : Result)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require "./example"
|
|||
module Spectator
|
||||
abstract class PendingExample < Example
|
||||
def run
|
||||
PendingExampleResult.new(self)
|
||||
PendingResult.new(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "./example_result"
|
||||
require "./result"
|
||||
|
||||
module Spectator
|
||||
class PendingExampleResult < ExampleResult
|
||||
class PendingResult < Result
|
||||
def passed?
|
||||
false
|
||||
end
|
|
@ -2,9 +2,9 @@ module Spectator
|
|||
class Report
|
||||
getter runtime : Time::Span
|
||||
|
||||
@results : Array(ExampleResult)
|
||||
@results : Array(Result)
|
||||
|
||||
def initialize(results : Enumerable(ExampleResult), @runtime)
|
||||
def initialize(results : Enumerable(Result), @runtime)
|
||||
@results = results.to_a
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Spectator
|
||||
abstract class ExampleResult
|
||||
abstract class Result
|
||||
getter example : Example
|
||||
getter elapsed : Time::Span
|
||||
|
|
@ -36,11 +36,11 @@ module Spectator
|
|||
private def translate_result(result)
|
||||
case (error = result.error)
|
||||
when Nil
|
||||
SuccessfulExampleResult.new(self, result.elapsed)
|
||||
SuccessfulResult.new(self, result.elapsed)
|
||||
when ExpectationFailed
|
||||
FailedExampleResult.new(self, result.elapsed, error)
|
||||
FailedResult.new(self, result.elapsed, error)
|
||||
else
|
||||
ErroredExampleResult.new(self, result.elapsed, error)
|
||||
ErroredResult.new(self, result.elapsed, error)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
require "./failed_example_result"
|
||||
require "./successful_example_result"
|
||||
|
||||
module Spectator
|
||||
class Runner
|
||||
def initialize(@group : ExampleGroup,
|
||||
|
@ -8,7 +5,7 @@ module Spectator
|
|||
end
|
||||
|
||||
def run : Nil
|
||||
results = [] of ExampleResult
|
||||
results = [] of Result
|
||||
elapsed = Time.measure do
|
||||
@formatter.start_suite
|
||||
results = @group.all_examples.map do |example|
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
require "./example_result"
|
||||
|
||||
module Spectator
|
||||
class SuccessfulExampleResult < ExampleResult
|
||||
def passed? : Bool
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
9
src/spectator/successful_result.cr
Normal file
9
src/spectator/successful_result.cr
Normal file
|
@ -0,0 +1,9 @@
|
|||
require "./result"
|
||||
|
||||
module Spectator
|
||||
class SuccessfulResult < Result
|
||||
def passed? : Bool
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue