Remove ExampleBase

Pending/skip functionality will be merged into Example or extend from 
it.
This commit is contained in:
Michael Miller 2020-09-05 19:54:55 -06:00
parent fbf574b0b9
commit 3a5dd76324
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
2 changed files with 7 additions and 25 deletions

View file

@ -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

View file

@ -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