mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add pass?/fail? methods to Result types
This commit is contained in:
parent
72b2e7ebcb
commit
b8b6b3b609
4 changed files with 36 additions and 0 deletions
|
@ -25,6 +25,16 @@ module Spectator
|
|||
visitor.failure(yield self)
|
||||
end
|
||||
|
||||
# Indicates whether the example passed.
|
||||
def pass? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
# Indicates whether the example failed.
|
||||
def fail? : Bool
|
||||
true
|
||||
end
|
||||
|
||||
# One-word description of the result.
|
||||
def to_s(io)
|
||||
io << "fail"
|
||||
|
|
|
@ -13,6 +13,16 @@ module Spectator
|
|||
visitor.pass(yield self)
|
||||
end
|
||||
|
||||
# Indicates whether the example passed.
|
||||
def pass? : Bool
|
||||
true
|
||||
end
|
||||
|
||||
# Indicates whether the example failed.
|
||||
def fail? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
# One-word description of the result.
|
||||
def to_s(io)
|
||||
io << "pass"
|
||||
|
|
|
@ -21,6 +21,16 @@ module Spectator
|
|||
visitor.pending(yield self)
|
||||
end
|
||||
|
||||
# Indicates whether the example passed.
|
||||
def pass? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
# Indicates whether the example failed.
|
||||
def fail? : Bool
|
||||
false
|
||||
end
|
||||
|
||||
# One-word description of the result.
|
||||
def to_s(io)
|
||||
io << "pending"
|
||||
|
|
|
@ -17,6 +17,12 @@ module Spectator
|
|||
# This is the visitor design pattern.
|
||||
abstract def accept(visitor)
|
||||
|
||||
# Indicates whether the example passed.
|
||||
abstract def pass? : Bool
|
||||
|
||||
# Indicates whether the example failed.
|
||||
abstract def fail? : Bool
|
||||
|
||||
# Creates a JSON object from the result information.
|
||||
def to_json(json : ::JSON::Builder, example)
|
||||
json.object do
|
||||
|
|
Loading…
Reference in a new issue