Public Variables and Functions
Usage: (are argv expr & args)
Checks multiple assertions with a template expression.
See clojure.template/do-template for an explanation of
Example: (are [x y] (= x y)
2 (+ 1 1)
4 (* 2 2))
(do (is (= 2 (+ 1 1)))
(is (= 4 (* 2 2))))
Note: This breaks some reporting features, such as line numbers.
Usage: (assert-any msg form)
Returns generic assertion code for any test, including macros, Java
method calls, or isolated symbols.
Usage: (assert-predicate msg form)
Returns generic assertion code for any functional predicate. The
'expected' argument to 'report' will contains the original form, the
'actual' argument will contain the form with all its sub-forms
evaluated. If the predicate returns false, the 'actual' form will
be wrapped in (not...).
Usage: (async done & body)
Wraps body as a CPS function that can be returned from a test to
continue asynchronously. Binds done to a function that must be
invoked once and from an async context after any assertions.
(js/setTimeout (fn 
;; make assertions in async context...
(done) ;; ...then call done
Usage: (deftest name & body)
Defines a test function with no arguments. Test functions may call
other tests, so tests may be composed. If you compose tests, you
should also define a function named test-ns-hook; run-tests will
call test-ns-hook instead of testing all vars.
Note: Actually, the test body goes in the :test metadata on the var,
and the real function (the value of the var) calls test-var on
When cljs.analyzer/*load-tests* is false, deftest is ignored.
Usage: (function? menv x)
Returns true if argument is a function or a symbol that resolves to
a function (not a macro).
Usage: (is form)
(is form msg)
Generic assertion macro. 'form' is any predicate test.
'msg' is an optional message to attach to the assertion.
Example: (is (= 4 (+ 2 2)) "Two plus two should be 4")
(is (thrown? c body)) checks that an instance of c is thrown from
body, fails if not; then returns the thing thrown.
(is (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.
(run-all-tests re env)
Runs all tests in all namespaces; prints results.
Optional argument is a regular expression; only namespaces with
names matching the regular expression (with re-matches) will be
(run-tests env-or-ns & namespaces)
Runs all tests in the given namespaces; prints results.
Defaults to current namespace if none given. Does not return a meaningful
value due to the possiblity of asynchronous execution. To detect test
completion add a :end-run-tests method case to the cljs.test/report
Usage: (run-tests-block env-or-ns & namespaces)
Like test-vars, but returns a block for further composition and
Usage: (test-all-vars [quote ns :as form])
Calls test-vars on every var with :test metadata interned in the
namespace, with fixtures.
Usage: (test-ns ns)
(test-ns env [quote ns :as form])
If the namespace defines a function named test-ns-hook, calls that.
Otherwise, calls test-all-vars on the namespace. 'ns' is a
namespace object or a symbol.
Internally binds *report-counters* to a ref initialized to
Usage: (test-ns-block env [quote ns :as form])
Like test-ns, but returns a block for further composition and
later execution. Does not clear the current env.
Usage: (testing string & body)
Adds a new string to the list of testing contexts. May be nested,
but must occur inside a test function (deftest).
Usage: (try-expr msg form)
Used by the 'is' macro to catch unexpected exceptions.
You don't call this.