Skip to main content

Assertions

47
  • IAsyncTest

    Marker protocol denoting CPS function to begin asynchronous testing.

  • are

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

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

  • async

    Wraps body as a CPS function that can be returned from a test to continue asynchronously. Binds done to a function that...

  • async?

    Returns whether x implements IAsyncTest.

  • block

    Tag a seq of fns to be picked up by run-block as injected continuation. See run-block.

  • compose-fixtures

    Composes two fixture functions, creating a new fixture function that combines their behavior. NOTE: Incompatible with m...

  • deftest

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

  • empty-env

    Generates a testing environment with a reporter. (empty-env) - uses the :cljs.test/default reporter. (empty-env :cljs.te...

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

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

  • run-block

    Invoke all functions in fns with no arguments. A fn can optionally return an async test - is invoked with a continuatio...

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

    Runs all tests in the given namespaces; prints results. Defaults to current namespace if none given. Does not return a m...

  • run-tests-block

    Like test-vars, but returns a block for further composition and later execution.

  • successful?

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

  • test-all-vars

    Calls test-vars on every var with :test metadata 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. 'n...

  • test-ns-block

    Like test-ns, but returns a block for further composition and later execution. Does not clear the current env.

  • test-var

    If v has a function in its :test metadata, calls that function, add v to :testing-vars property of env.

  • test-var-block

    Like test-var, but returns a block for further composition and later execution.

  • test-vars

    Groups vars by their namespace and runs test-var on them with appropriate fixtures assuming they are present in the curr...

  • test-vars-block

    Like test-vars, but returns a block for further composition and later execution.

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

  • try-expr

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