Skip to main content

Assertions

37
  • 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).

  • 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. Ex...

  • 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-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.

  • 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-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-vars 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*.