mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Initial structure for matchers
This commit is contained in:
parent
b709820e11
commit
7ec33943a4
3 changed files with 31 additions and 0 deletions
18
src/spectator/matchers/equality_matcher.cr
Normal file
18
src/spectator/matchers/equality_matcher.cr
Normal file
|
@ -0,0 +1,18 @@
|
|||
require "./matcher"
|
||||
|
||||
def eq(expected : T) forall T
|
||||
Spectator::Matchers::EqualityMatcher(T).new(expected)
|
||||
end
|
||||
|
||||
module Spectator
|
||||
module Matchers
|
||||
class EqualityMatcher(T) < Matcher
|
||||
def initialize(@expected : T)
|
||||
end
|
||||
|
||||
def match?(expectation : Expectation)
|
||||
expectation.actual == @expected
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
7
src/spectator/matchers/matcher.cr
Normal file
7
src/spectator/matchers/matcher.cr
Normal file
|
@ -0,0 +1,7 @@
|
|||
module Spectator
|
||||
module Matchers
|
||||
abstract class Matcher
|
||||
abstract def match?(expectation : Expectation)
|
||||
end
|
||||
end
|
||||
end
|
6
src/spectator/mathers.cr
Normal file
6
src/spectator/mathers.cr
Normal file
|
@ -0,0 +1,6 @@
|
|||
require "./matchers/*"
|
||||
|
||||
module Spectator
|
||||
module Matchers
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue