Closed dchelimsky closed 4 years ago
NOTE: since this is a breaking change, we should hold off on releasing 2.0.0 until this is vetted and merged.
Which is the use case for the 1-arity version?
Which is the use case for the 1-arity version?
It separates the details exposed by the match
function, used in e.g. the match?
assert-expr, from the "matchiness" (boolean result) indicated by those details.
We only use the result#
in this case when match?
returns false
in order to report out to the user, but this code doesn't have to know the semantics of the result of match
.
Suggestion from @rafaelzlisboa in standup today: perhaps the 2 arities of match?
should be different functions. Moving this to Draft state while we explore this further.
We went with #128 instead.
There are currently 3 versions of
match?
:matcher-combinators.core/match?
matcher-combinators.standalone/match?
matcher-combinators.test/match?
(clojure.testassert-expr
- not really a function)They all have different semantics, which is cause for much confusion.
This PR aligns them as follows:
(match? expected actual)
, whereexpected
could be a value or a matchercore
andstandalone
functions each have an arity-1 version e.g.(match? match-result)
What changed?
standalone.match?
with one arg expects a match-result and returns a booleancore.match?
now supports 1 argumentfdefs
for both versions are the same, and have moved to a newspecs
namespace so they are only loaded when needed (in tests)