Initial structure for matchers
This commit is contained in:
parent
b709820e11
commit
7ec33943a4
|
@ -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
|
|
@ -0,0 +1,7 @@
|
|||
module Spectator
|
||||
module Matchers
|
||||
abstract class Matcher
|
||||
abstract def match?(expectation : Expectation)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
require "./matchers/*"
|
||||
|
||||
module Spectator
|
||||
module Matchers
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue