The are
macro is also part of the clojure.test
library. It allows you to make multiple assertions against a template.
For example:
(are [x y] (= x y)
4 (+ 2 2)
8 (* 2 4))
=> true
Here, (= x y)
acts as a template which takes each argument and creates an is
assertion out of it.
This expands to multiple is
assertions:
(do
(is (= 4 (+ 2 2)))
(is (= 8 (* 2 4))))