From 07c565add49c266f5e85eb29099ba1f8651f17b3 Mon Sep 17 00:00:00 2001 From: Olli <1998952+pikariop@users.noreply.github.com> Date: Tue, 15 Sep 2026 20:45:08 +0300 Subject: [PATCH 1/4] Remove extra trailing parens --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0862ec3..258adce 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ For example: (is (match? {:name/first "Alfredo"} {:name/first "Alfredo" :name/last "da Rocha Viana" - :name/suffix "Jr."})))) + :name/suffix "Jr."}))) (deftest test-matching-nested-datastructures ;; Maps, sequences, and sets follow the same semantics whether at @@ -219,7 +219,7 @@ The `via` matcher can help us out with this: (is (match? (m/match-with [vector? (fn [expected] (m/via sort expected))] {:payloads [1 2 3]}) - {:payloads (shuffle [3 2 1])})))) + {:payloads (shuffle [3 2 1])}))) ``` In this example we decorate `vector?`'s matcher to first sort the `actual` and then do matching. From d8b4cc2b2556bd851e81cd2e5bf92b0168ae3c2e Mon Sep 17 00:00:00 2001 From: Olli <1998952+pikariop@users.noreply.github.com> Date: Tue, 15 Sep 2026 20:45:50 +0300 Subject: [PATCH 2/4] Provide a value for `expected`, and wrap tests in `is` so that `match?` is available --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 258adce..cb47dbd 100644 --- a/README.md +++ b/README.md @@ -236,12 +236,13 @@ Negative matchers, that is, those asserting the absence of something, are genera ```clojure (deftest avoid-negative-matchers - (testing "normal assertion that `:a` is present" - (match? {:a any?} - actual)) - (testing "double negation version" - (match? (matcher-combinators.matchers/mismatch {:a matcher-combinators.matchers/absent}) - actual))) + (let [actual {:a 1}] + (testing "normal assertion that `:a` is present" + (is (match? {:a any?} + actual))) + (testing "double negation version" + (is (match? (matcher-combinators.matchers/mismatch {:a matcher-combinators.matchers/absent}) + actual))))) ``` ### building new matchers From b6eb1e5aa9f5165f760b098a6ed218a93f3009cf Mon Sep 17 00:00:00 2001 From: Olli <1998952+pikariop@users.noreply.github.com> Date: Tue, 15 Sep 2026 20:51:41 +0300 Subject: [PATCH 3/4] Slurp the map literal into the match form --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb47dbd..96a96a6 100644 --- a/README.md +++ b/README.md @@ -273,8 +273,8 @@ For convenience we've also added the built-in matcher `nested-equals` to reduce ``` clojure (deftest exact-map-matching-with-match-with - (is (match? (m/nested-equals {:a {:b {:c odd?}}})) - {:a {:b {:c 1}}})) + (is (match? (m/nested-equals {:a {:b {:c odd?}}}) + {:a {:b {:c 1}}}))) ``` ## Development From c186e965dbd965c6b18390fe4c3fedd9d5406489 Mon Sep 17 00:00:00 2001 From: Olli <1998952+pikariop@users.noreply.github.com> Date: Tue, 15 Sep 2026 22:02:23 +0300 Subject: [PATCH 4/4] Remove the extra map literal around `result` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96a96a6..6168763 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ The `via` matcher can help us out with this: ```clojure (let [result {:payloads ["{:foo :bar :baz :qux}"]}] (is (match? {:payloads [(m/via read-string {:foo :bar})]} - {:payloads result}))) + result))) ``` `via`, when paired with `match-with`, can be used to apply `actual` pre-processing before applying an underlying matcher: