A simple matching library, moslty for tests. Usage:
(require '[alike.core :as alike]) ;; to extend clojure.test/do-report
(is (alike {:foo 42} (get-data))
Extending:
(defmethod -match [org.test.ExpectedType org.test.ActualType] [expected actual] (or (checking-logic? expected actual) (mismatch set obj :some-unique-tag)))
(defmethod -explain :some-unique-tag [mismatch] (format <your error %s message %s saying %s what is wrong> ...))
A simple matching library, moslty for tests. Usage:
(require '[alike.core :as alike]) ;; to extend clojure.test/do-report
(is (alike {:foo 42} (get-data))
Extending:
(defmethod -match [org.test.ExpectedType org.test.ActualType]
[expected actual]
(or (checking-logic? expected actual)
(mismatch set obj :some-unique-tag)))
(defmethod -explain :some-unique-tag [mismatch]
(format <your error %s message %s saying %s what is wrong>
...))
(match expected actual)A top-level API function to call. Transforms negative results into Mismatch objects. The result is always one of these:
A top-level API function to call. Transforms negative results into Mismatch objects. The result is always one of these: - Mismatch - true
(mismatch expected actual)(mismatch expected actual tag)(mismatch expected actual tag level)Build a Mismatch object in various ways.
Build a Mismatch object in various ways.
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 |