Closed
Description
Context
macroexpand=
is great; but unifies any symbol it recognizes as a gensym. providing a matcher-combinators matcher for gensyms allows for more specific matches
Task
- add a GensymMatcher + wrapper fns
- add readme examples
Additional resources
Blocked by #28, at least for the opt-in requirement of m-c.
In an internal project we use:
(defrecord GensymMatcher [expected]
matcher-combinators.core/Matcher
(match [_this actual]
(let [value (symbol (string/replace actual #"(.?+)(\d)*" "$1"))]
(if (= expected value)
{:matcher-combinators.result/type :match
:matcher-combinators.result/value value
:matcher-combinators.result/weight 0}
{:matcher-combinators.result/type :mismatch
:matcher-combinators.result/value (model/->Mismatch expected value)
:matcher-combinators.result/weight 1}))))
Metadata
Metadata
Assignees
Labels
No labels