io.jesi.customs.strict
=
(= x y & more)
Equality. Takes at least 2 args. Returns `true` if `x` equals `y`, `false` if not.
Same as Java `x.equals(y)` except it also works for `nil`, and compares numbers
and collections in a type-independent manner. Clojure's immutable data structures
define `equals()` (and thus `=`) as a value, not an identity, comparison.
are
macro
(are argv expr & args)
deftest
macro
(deftest name & body)
Like `clojure.test/deftest`, but will fail if `body` is empty.
is
macro
(is form)
(is form msg)
Generic assertion macro. `form` is any predicate test.
`msg` is an optional message to attach to the assertion.
Will fail is message is not a string.
Example: `(is (= 4 (+ 2 2)) "Two plus two should be 4")`
Special forms:
`thrown?` checks that an instance of `c` is thrown from
body, fails if not; then returns the thing thrown.
`thrown-with-msg?` checks that an instance of `c` is
thrown from `body` and that the message on the exception
matches (with `re-find`) the regular expression `re`.
testing
macro
(testing string & body)
Like `clojure.test/testing`, but will fail if `body` is empty.
thrown-with-msg?
(thrown-with-msg? c re body)
Checks that an instance of `c` is thrown AND that the message
on the exception matches (with re-find) the regular expression `re`.
Must be used in an `is` block.
thrown?
(thrown? c body)
Checks that an instance of `c` is thrown from `body`, fails if not;
then returns the thing thrown. Must be used in an `is` block.
use-fixtures
macro
(use-fixtures type & fns)
Wrap test runs in a fixture function to perform setup and
teardown. Using a fixture-type of :each wraps every test
individually, while :once wraps the whole run in a single function.