Initial structure for matchers

This commit is contained in:
Michael Miller 2018-08-23 12:44:18 -06:00
parent b709820e11
commit 7ec33943a4
3 changed files with 31 additions and 0 deletions

View 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

View 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
View File

@ -0,0 +1,6 @@
require "./matchers/*"
module Spectator
module Matchers
end
end