diff --git a/src/spectator/matchers/equality_matcher.cr b/src/spectator/matchers/equality_matcher.cr new file mode 100644 index 0000000..0c6e39d --- /dev/null +++ b/src/spectator/matchers/equality_matcher.cr @@ -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 diff --git a/src/spectator/matchers/matcher.cr b/src/spectator/matchers/matcher.cr new file mode 100644 index 0000000..7de1d15 --- /dev/null +++ b/src/spectator/matchers/matcher.cr @@ -0,0 +1,7 @@ +module Spectator + module Matchers + abstract class Matcher + abstract def match?(expectation : Expectation) + end + end +end diff --git a/src/spectator/mathers.cr b/src/spectator/mathers.cr new file mode 100644 index 0000000..0f43d00 --- /dev/null +++ b/src/spectator/mathers.cr @@ -0,0 +1,6 @@ +require "./matchers/*" + +module Spectator + module Matchers + end +end