code.test
all
added in 3.0
(all & cks)checker that allows and composition of checkers
(mapv (all even? #(< 3 %)) 1 2 3 4 5) => false false false true false
any
added in 3.0
(any & cks)checker that allows or composition of checkers
(mapv (any even? 1) 1 2 3 4 5) => true true false true false
anything
added in 3.0
(anything x)approx
added in 3.0
(approx v)(approx v threshold)checker that allows approximate verifications
((approx 1) 1.000001) => true
((approx 1) 1.1) => false
((approx 1 0.0000001) 1.001) => false
capture
macro
added in 3.0
(capture)(capture checker)(capture checker sym)adds a form to capture test input
contains
added in 3.0
(contains x & modifiers)contains-in
macro
added in 3.0
(contains-in x)shorthand for checking nested maps and vectors
((contains-in {:a {:b {:c odd?}}}) {:a {:b {:c 1 :d 2}}}) => true
((contains-in odd? {:a {:b even?}}) 3 {:a {:b 4 :c 5}}) => true
exactly
added in 3.0
(exactly v)(exactly v function)checker that allows exact verifications
((exactly 1) 1) => true
((exactly Long) 1) => false
((exactly number?) 1) => false
fact:exec
macro
added in 3.0
(fact:exec)(fact:exec id)(fact:exec ns id)runs main hook for fact form
fact:get
macro
added in 3.0
(fact:get)(fact:get id)(fact:get ns id)gets elements of the current fact
fact:global
macro
added in 3.0
(fact:global)(fact:global cmd & args)fact global getter and setter
(fact:global)
fact:missing
added in 3.0
(fact:missing)(fact:missing ns)returns all missing facts for a given namespace
is-not
added in 3.0
(is-not ck)(is-not ck function)checker that allows negative composition of checkers
(mapv (is-not even?) 1 2 3 4 5) => true false true false true
just
added in 3.0
(just x & modifiers)just-in
macro
added in 3.0
(just-in x)shorthand for exactly checking nested maps and vectors
((just-in {:a {:b {:c odd?}}}) {:a {:b {:c 1 :d 2}}}) => false
((just-in odd? {:a {:b even?}}) 3 {:a {:b 4}})
((just-in odd? {:a {:b even?}}) 3 {:a {:b 4}}) => true
print-options
added in 3.0
(print-options)(print-options opts)output options for test results
(task/print-options) => #{:disable :default :all :current :help}
(task/print-options :default) => #{:print-bulk :print-failed :print-throw}
run
added in 3.0
(run)(run ns)(run ns params)(run ns params project)(run ns params lookup project)runs all tests
(task/run :list)
(task/run ’std.lib.foundation) ;; {:files 1, :throw 0, :facts 8, :checks 18, :passed 18, :failed 0} => map?
run-errored
added in 3.0
(run-errored)runs only the tests that have errored
(task/run-errored)
run:current
added in 4.0
(run:current)(run:current ns)(run:current ns params)(run:current ns params project)(run:current ns params lookup project)runs the current namespace
run:load
added in 3.0
(run:load)(run:load ns)(run:load ns params)(run:load ns params project)(run:load ns params lookup project)load test namespace
run:report
added in 4.1
(run:report path)(run:report path params)(run:report path params project)runs only failed tests recorded in a saved report file
(task/run:report “.hara/runs/run-1781734545292.edn”)
run:test
added in 3.0
(run:test)(run:test ns)(run:test ns params)(run:test ns params project)(run:test ns params lookup project)runs loaded tests
run:unload
added in 3.0
(run:unload)(run:unload ns)(run:unload ns params)(run:unload ns params project)(run:unload ns params lookup project)unloads the test namespace
satisfies
added in 3.0
(satisfies v)(satisfies v function)checker that allows loose verifications
((satisfies 1) 1) => true
((satisfies Long) 1) => true
((satisfies number?) 1) => true
((satisfies #{1 2 3}) 1) => true
((satisfies 1 2 3) 1) => false
((satisfies number?) “e”) => false
((satisfies #“hello”) #“hello”) => true
stores
added in 3.0
(stores v)a checker that looks into a ref object
((stores 1) (volatile! 1)) => true
((stores 1) 1) => false
throws
added in 3.0
(throws)(throws e)(throws e msg)checker that determines if an exception has been thrown
((throws Exception “Hello There”) (res/result {:status :exception :data (Exception. “Hello There”)})) => true
throws-info
added in 3.0
(throws-info)(throws-info m)checker that determines if an ex-info has been thrown
((throws-info {:a “hello” :b “there”}) (process/evaluate {:form ’(throw (ex-info “hello” {:a “hello” :b “there”}))})) => true