Skip to main content

Assertions

38
  • *load-tests*

    True by default. If set to false, no test functions will be created by deftest, set-test, or with-test. Use this to...

  • *stack-trace-depth*

    The maximum depth of stack traces to print when an Exception is thrown during a test. Defaults to nil, which means pr...

  • are

    Checks multiple assertions with a template expression. See clojure.template/do-template for an explanation of templa...

  • assert-any

    Returns generic assertion code for any test, including macros, Java method calls, or isolated symbols.

  • assert-predicate

    Returns generic assertion code for any functional predicate. The 'expected' argument to 'report' will contains the or...

  • compose-fixtures

    Composes two fixture functions, creating a new fixture function that combines their behavior.

  • deftest

    Defines a test function with no arguments. Test functions may call other tests, so tests may be composed. If you com...

  • deftest-

    Like deftest but creates a private var.

  • do-report

    Add file and line information to a test result and call report. If you are writing a custom assert-expr method, call ...

  • function?

    Returns true if argument is a function or a symbol that resolves to a function (not a macro).

  • get-possibly-unbound-var

    Like var-get but returns nil if the var is unbound.

  • inc-report-counter

    Increments the named counter in *report-counters*, a ref to a map. Does nothing if *report-counters* is nil.

  • is

    Generic assertion macro. 'form' is any predicate test. 'msg' is an optional message to attach to the assertion. ...

  • join-fixtures

    Composes a collection of fixtures, in order. Always returns a valid fixture function, even if the collection is empty...

  • report

    Generic reporting function, may be overridden to plug in different report formats (e.g., TAP, JUnit). Assertions suc...

  • run-all-tests

    Runs all tests in all namespaces; prints results. Optional argument is a regular expression; only namespaces with na...

  • run-test

    Runs a single test. Because the intent is to run a single test, there is no check for the namespace test-ns-hook.

  • run-test-var

    Runs the tests for a single Var, with fixtures executed around the test, and summary output after.

  • run-tests

    Runs all tests in the given namespaces; prints results. Defaults to current namespace if none given. Returns a map ...

  • set-test

    Experimental. Sets :test metadata of the named var to a fn with the given body. The var must already exist. Does no...

  • successful?

    Returns true if the given test summary indicates all tests were successful, false otherwise.

  • test-all-vars

    Calls test-vars on every var interned in the namespace, with fixtures.

  • test-ns

    If the namespace defines a function named test-ns-hook, calls that. Otherwise, calls test-all-vars on the namespace. ...

  • test-var

    If v has a function in its :test metadata, calls that function, with *testing-vars* bound to (conj *testing-vars* v).

  • test-vars

    Groups vars by their namespace and runs test-var on them with appropriate fixtures applied.

  • testing

    Adds a new string to the list of testing contexts. May be nested, but must occur inside a test function (deftest).

  • testing-contexts-str

    Returns a string representation of the current test context. Joins strings in *testing-contexts* with spaces.

  • testing-vars-str

    Returns a string representation of the current test. Renders names in *testing-vars* as a list, then the source file ...

  • try-expr

    Used by the 'is' macro to catch unexpected exceptions. You don't call this.

  • use-fixtures

    Wrap test runs in a fixture function to perform setup and teardown. Using a fixture-type of :each wraps every test i...

  • with-test

    Takes any definition form (that returns a Var) as the first argument. Remaining body goes in the :test metadata functi...

  • with-test-out

    Runs body with *out* bound to the value of *test-out*.