This namespace provides compatibility with clojure.test and related tooling. This namespace can be used standalone, without requiring the 'expectations' namespace -- all functionality from that namespace is exposed via this one.
When this namespace is loaded, the 'run on shutdown' hook is automatically disabled -- tests are named functions that get run explicitly instead.
We do not support ClojureScript in clojure.test mode, sorry.
This namespace provides compatibility with clojure.test and related tooling. This namespace can be used standalone, without requiring the 'expectations' namespace -- all functionality from that namespace is exposed via this one. When this namespace is loaded, the 'run on shutdown' hook is automatically disabled -- tests are named functions that get run explicitly instead. We do not support ClojureScript in clojure.test mode, sorry.
(->failure-message {:keys [raw ref-data result expected-message actual-message
message list show-raw]})
(->test-report m s x k)
Given a test report map, a symbolic form, a value (produced from it), and the next report key (:actual or :expected), merge in more elements to build up a test report that clojure.test can use to report the failure, based either on the form or the value, or both.
Given a test report map, a symbolic form, a value (produced from it), and the next report key (:actual or :expected), merge in more elements to build up a test report that clojure.test can use to report the failure, based either on the form or the value, or both.
(approximately v)
(approximately v d)
Given a value and an optional delta (default 0.001), return a predicate that expects its argument to be within that delta of the given value.
Given a value and an optional delta (default 0.001), return a predicate that expects its argument to be within that delta of the given value.
(clean-up-exception ex)
Given an expected exception, return a simpler representation of it that clojure.test's reporting can display nicely.
Given an expected exception, return a simpler representation of it that clojure.test's reporting can display nicely.
(defexpect n & body)
Given a name (a symbol that may include metadata) and a test body, produce a standard 'clojure.test' test var (using 'deftest').
(defexpect name expected actual) is a special case shorthand for (defexpect name (expect expected actual)) provided as an easy way to migrate legacy Expectation tests to the 'clojure.test' compatibility version.
Given a name (a symbol that may include metadata) and a test body, produce a standard 'clojure.test' test var (using 'deftest'). (defexpect name expected actual) is a special case shorthand for (defexpect name (expect expected actual)) provided as an easy way to migrate legacy Expectation tests to the 'clojure.test' compatibility version.
(expect a)
(expect e a)
Expectations' equivalent to clojure.test's 'is' macro.
Expectations' equivalent to clojure.test's 'is' macro.
(expecting string & body)
The Expectations version of clojure.test/testing.
The Expectations version of clojure.test/testing.
(fold-messages-together m)
Given a test report, attempt to fold in additional information from our Expectations report so that clojure.test can provide more details.
Given a test report, attempt to fold in additional information from our Expectations report so that clojure.test can provide more details.
(functionally expected-fn actual-fn)
(functionally expected-fn actual-fn difference-fn)
Given a pair of functions, return a custom predicate that checks that they return the same result when applied to a value. May optionally accept a 'difference' function that should accept the result of each function and return a string explaininhg how they actually differ. For explaining strings, you could use expectations/strings-difference.
Given a pair of functions, return a custom predicate that checks that they return the same result when applied to a value. May optionally accept a 'difference' function that should accept the result of each function and return a string explaininhg how they actually differ. For explaining strings, you could use expectations/strings-difference.
(readme)
(readme readme-path test-path)
If invoked with no arguments, as happens when this namespace is loaded, then based on environment variables and system properties, parse the specified file (normally a readme) and generate a test file based on the Clojure code fragments found inside it. Can also be invoked with the path of the readme source file and the output path for the generated readme.clj test file. This arity is intended for use by tooling that wants to directly control this operation.
If invoked with no arguments, as happens when this namespace is loaded, then based on environment variables and system properties, parse the specified file (normally a readme) and generate a test file based on the Clojure code fragments found inside it. Can also be invoked with the path of the readme source file and the output path for the generated readme.clj test file. This arity is intended for use by tooling that wants to directly control this operation.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close