deftest
is a macro for defining a unit test, similar to unit tests in other languages.
You can create a test as follows:
(deftest add-nums
(is (= 2 (+ 1 1)))
(is (= 3 (+ 1 2))))
Here we are defining a test called add-nums
, which tests the +
function. The test has two assertions.
You can then run the test like this in your current namespace:
(run-tests)
Or you can just run the tests for the namespace the test is in:
(run-tests 'your-ns)