A very simple inline testing library.
(require '[clj-arsenal.check :refer [check when-check samp samps expect]])
(check ::my-bad-check
(expect = 1 2))
(check ::my-good-check
(let [i (samp :integer)]
(expect = i i)))
(when-check
(defn foo [x y] (+ x y)))
(check ::another-check
(expect = (foo 1 2) (foo 2 1)))
nil
:clj-arsenal.check/enabled
to true in your deps alias:clj-arsenal.check/ns-include-re
and/or :clj-arsenal.check/ns-exclude-re
regexes in your deps alias.:clj-arsenal.check/reporter
to the qualified symbol of a custom reporter
function.samp
(one value) or samps
(multiple values). Only :integer
and :string
generators are currently
built-in. Add more by adding clj-arsenal/check/generators.edn
files to the
classpath; which contain maps of key -> qualified-generator-function-symnol
.
Generator functions are called from Clojure (i.e the macro, not at runtime).clj-arsenal.check/!status
atom. For CI tests, add-watch
this atom to figure out when all checks have
passed, or if any have failed. The values of this map will be one of
clj-arsenal.check/failure
, clj-arsenal.check/success
, or clj-arsenal.check/pending
.Currently this library works for Clojure and ClojureScript. It can also be used
within mixed ClojureDart projects, but the checks will always expand to nil
. A
different approach needs to be used with ClojureDart, due to to the semantics
of Dart itself; but there are plans to try and make something work.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close