mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Create abstract conditional matcher
This commit is contained in:
parent
a88c6545d9
commit
90de8c312d
1 changed files with 20 additions and 0 deletions
20
src/spectator/matchers/condition_matcher.cr
Normal file
20
src/spectator/matchers/condition_matcher.cr
Normal file
|
@ -0,0 +1,20 @@
|
|||
require "./matcher"
|
||||
|
||||
module Spectator::Matchers
|
||||
# Category of matcher that checks if an actual value satisfies a condition.
|
||||
# Sub-types must implement `#match?`, `#message`, and `#negated_message`.
|
||||
# Those methods accept a `ValueExpectationPartial` to work with.
|
||||
abstract struct ConditionMatcher < Matcher
|
||||
# Determines whether the matcher is satisfied with the value given to it.
|
||||
# True is returned if the matcher is satisfied, false otherwise.
|
||||
abstract def match?(partial : ValueExpectationPartial(ActualType)) : Bool forall ActualType
|
||||
|
||||
# Describes the condition that satisfies the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
abstract def message(partial : ValueExpectationPartial(ActualType)) : String forall ActualType
|
||||
|
||||
# Describes the condition that won't satsify the matcher.
|
||||
# This is informational and displayed to the end-user.
|
||||
abstract def negated_message(partial : ValueExpectationPartial(ActualType)) : String forall ActualType
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue