(all* c & cs)
Takes one or more checker
s, and returns a new checker
.
That checker takes an actual
argument, and calls every checker with it as the first and only argument.
Returns nil or a sequence of maps matching check-failure?
.
Takes one or more `checker`s, and returns a new `checker`. That checker takes an `actual` argument, and calls every checker with it as the first and only argument. Returns nil or a sequence of maps matching `check-failure?`.
(append-message message failures)
WARNING: INTERNAL HELPER, DO NOT USE!
WARNING: INTERNAL HELPER, DO NOT USE!
(checker arglist & args)
Creates a function that takes only one argument (usually named actual
).
For use in =check=> assertions.
NOTE: the fact that a checker is just a fn with metadata is an internal detail, do not rely on that fact, and prefer usage of this checker
macro.
Creates a function that takes only one argument (usually named `actual`). For use in =check=> assertions. NOTE: the fact that a checker is just a fn with metadata is an internal detail, do not rely on that fact, and prefer usage of this `checker` macro.
(checker? x)
Checks if passed in argument was a function created by the checker
macro.
NOTE: the fact that a checker is just a fn with metadata is an internal detail, do not rely on that fact, and prefer usage of the checker
macro.
Checks if passed in argument was a function created by the `checker` macro. NOTE: the fact that a checker is just a fn with metadata is an internal detail, do not rely on that fact, and prefer usage of the `checker` macro.
(embeds?* expected)
Takes a map and returns a checker that checks if the values at the keys match (using =
) .
The map values can be checker
s, but will throw an error if passed a raw function.
The map can be arbitrarily nested with further maps, eg:
(embeds?* {:a 1, :b {:c (is?* even?)}}) =check=> {:a 1, :b {:c 2}}
Takes a map and returns a checker that checks if the values at the keys match (using `=`) . The map values can be `checker`s, but will throw an error if passed a raw function. The map can be arbitrarily nested with further maps, eg: ``` (embeds?* {:a 1, :b {:c (is?* even?)}}) =check=> {:a 1, :b {:c 2}} ```
(equals?* expected)
Takes any value and returns a checker that checks for equality.
Takes any value and returns a checker that checks for equality.
(every?* c & cs)
Takes one or more checkers, and returns a checker that runs all checker arguments on each element of the checker argument sequence.
Takes one or more checkers, and returns a checker that runs all checker arguments on each element of the checker argument sequence.
(exists?* msg)
Takes a failure message and returns a checker that checks for non-nil values.
Takes a failure message and returns a checker that checks for non-nil values.
(in* path c & cs)
Takes a path and one or more checkers, and returns a checker that focuses the checker argument on the result of running (get-in actual path)
.
If the call to get-in
failed it returns a check-failure?
.
Takes a path and one or more checkers, and returns a checker that focuses the checker argument on the result of running `(get-in actual path)`. If the call to `get-in` failed it returns a `check-failure?`.
(is?* predicate)
Takes any truthy predicate function and returns a checker that checks with said predicate.
Takes any truthy predicate function and returns a checker that checks with said predicate.
(prepend-message msg fail)
WARNING: INTERNAL HELPER, DO NOT USE!
WARNING: INTERNAL HELPER, DO NOT USE!
(re-find?* regex)
Takes a regex (or string) and returns a checker that checks using re-find
.
Takes a regex (or string) and returns a checker that checks using `re-find`.
(seq-matches?* coll)
Takes a sequential?
collection, and returns a checker that checks its argument in a sequential manner, ie:
(seq-matches?* [1 2]) =check=> [1 2]
Can also take checkers as values, eg:
(seq-matches?* [(is?* pos?)]) =check=> [42]
Takes a `sequential?` collection, and returns a checker that checks its argument in a sequential manner, ie: `(seq-matches?* [1 2]) =check=> [1 2]` Can also take checkers as values, eg: `(seq-matches?* [(is?* pos?)]) =check=> [42]`
(valid?* spec)
Takes any valid clojure.spec.alpha/spec and returns a checker.
The checker checks with s/valid?
and calls s/explain-str
for the :message
.
Takes any valid clojure.spec.alpha/spec and returns a checker. The checker checks with `s/valid?` and calls `s/explain-str` for the `:message`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close