Integration with clojure.test or cljs.test (depending on which platform you're running on).
This namespace provides useful placeholder vars for match?, match-with?, thrown-match? and match-roughly?; the placeholders are nil (the actual implementations are extended via the clojure.test/assert-expr multimethod), but importing these will prevent linters from flagging otherwise undefined names.
Even if not concerned about linting, it is necessary to have some namespace require matcher-combinators.test to ensure that match? and friends can be used withing clojure.test/is.
Commonly, a dev-only user namespace will require this namespace.
Integration with clojure.test or cljs.test (depending on which platform you're running on). This namespace provides useful placeholder vars for match?, match-with?, thrown-match? and match-roughly?; the placeholders are nil (the actual implementations are extended via the clojure.test/assert-expr multimethod), but importing these will prevent linters from flagging otherwise undefined names. Even if not concerned about linting, it is necessary to have some namespace require matcher-combinators.test to ensure that match? and friends can be used withing clojure.test/is. Commonly, a dev-only user namespace will require this namespace.
Allows you to define a custom clojure.test match assert:
(defmethod clojure.test/assert-expr 'abs-value? [msg form] (build-match-assert 'abs-value? [int? abs-value-matcher] msg form))
Allows you to define a custom clojure.test match assert: `(defmethod clojure.test/assert-expr 'abs-value? [msg form] (build-match-assert 'abs-value? [int? abs-value-matcher] msg form))`
(match-roughly? delta matcher actual)DEPRECATED: Instead use (match? (matcher-combinators.matchers/match-with [number? (matcher-combinators.matchers/within-delta 0.01M)] <expected>) <actual>)
DEPRECATED: Instead use (match? (matcher-combinators.matchers/match-with [number? (matcher-combinators.matchers/within-delta 0.01M)] <expected>) <actual>)
(match-with? type->matcher matcher actual)DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead.
DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead.
(match? matcher actual)Asserts that the actual matches the expected, where the expected can be a value, a predicate function, or a matcher-combinator.
(is (match? [0 1 2] (range 3))) (is (match? (complement empty?) (range 3))) (is (match? (matcher-combinators.matchers/in-any-order [zero? odd? even?]) (range 3)))
Asserts that the `actual` matches the `expected`, where the `expected` can be a value, a predicate function, or a matcher-combinator. (is (match? [0 1 2] (range 3))) (is (match? (complement empty?) (range 3))) (is (match? (matcher-combinators.matchers/in-any-order [zero? odd? even?]) (range 3)))
(thrown-match? matcher actual)(thrown-match? exception-class matcher actual)Asserts that evaluating expr throws an exception where the excpetion's ex-data satisfies the provided matcher.
2-arity: (is (thrown-with-match? matcher expr)) 3-arity: (is (thrown-with-match? exception-class matcher expr))
Asserts that evaluating expr throws an exception where the excpetion's ex-data satisfies the provided matcher. 2-arity: (is (thrown-with-match? matcher expr)) 3-arity: (is (thrown-with-match? exception-class matcher expr))
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |