mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove ExampleBase
Pending/skip functionality will be merged into Example or extend from it.
This commit is contained in:
parent
fbf574b0b9
commit
3a5dd76324
2 changed files with 7 additions and 25 deletions
|
@ -1,12 +1,12 @@
|
|||
require "./context_delegate"
|
||||
require "./example_base"
|
||||
require "./example_group"
|
||||
require "./example_node"
|
||||
require "./result"
|
||||
require "./source"
|
||||
|
||||
module Spectator
|
||||
# Standard example that runs a test case.
|
||||
class Example < ExampleBase
|
||||
class Example < ExampleNode
|
||||
# Indicates whether the example already ran.
|
||||
getter? finished : Bool = false
|
||||
|
||||
|
@ -30,5 +30,10 @@ module Spectator
|
|||
def run : Result
|
||||
raise NotImplementedError.new("#run")
|
||||
end
|
||||
|
||||
# Exposes information about the example useful for debugging.
|
||||
def inspect(io)
|
||||
raise NotImplementedError.new("#inspect")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
require "./example_node"
|
||||
require "./result"
|
||||
|
||||
module Spectator
|
||||
# Common base type for all examples.
|
||||
abstract class ExampleBase < ExampleNode
|
||||
# Retrieves the result of the last time the example ran.
|
||||
# This will be nil if the example hasn't run,
|
||||
# and should not be nil if it has.
|
||||
abstract def result? : Result?
|
||||
|
||||
# Retrieves the result of the last time the example ran.
|
||||
# Raises an error if the example hasn't run.
|
||||
def result : Result
|
||||
result? || raise(NilAssertionError("Example has no result"))
|
||||
end
|
||||
|
||||
# Exposes information about the example useful for debugging.
|
||||
def inspect(io)
|
||||
raise NotImplementedError.new("#inspect")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue