Liking cljdoc? Tell your friends :D

midje.checking.checkers.defining

Various ways to define checkers.

Various ways to define checkers.
raw docstring

as-checkerclj

(as-checker function)

Label a function as a checker. This is only required if the checker is to be used on the left-hand-side of a prerequisite. See (guide checkers-within-prerequisites). Example:

(fact (f 3) => "odd number received" (provided (g (as-checker odd?)) => "odd number received"))

Label a function as a checker. This is only required if
the checker is to be used on the left-hand-side of a prerequisite.
See `(guide checkers-within-prerequisites)`.
Example:

   (fact (f 3) => "odd number received"
     (provided
       (g (as-checker odd?)) => "odd number received"))
sourceraw docstring

checkercljmacro

(checker args & body)

Creates an anonymous function tagged as a checker. Such tagging is only needed if the checker is to be used on the left-hand-side of a prerequisite. See (guide checkers-within-prerequisites). Example: (provided (f (checker [x] (and (pos? x) (even? x)))) => 3)

Creates an anonymous function tagged as a checker. Such tagging is only
needed if the checker is to be used on the left-hand-side of a
prerequisite.  See `(guide checkers-within-prerequisites)`.
Example:
    (provided
       (f (checker [x] (and (pos? x) (even? x)))) => 3)
sourceraw docstring

checker-makersclj

source

checker?clj

(checker? item)
source

defcheckercljmacro

(defchecker name docstring? attr-map? bindings+bodies)

Like defn, but tags the variable created and the function it refers to as checkers. This is only required if the checker is to be used in the left-hand side of a prerequisite, but it never hurts to define checkers using this. Here is a checker for positive even numbers:

(defchecker twosie [actual]
   (and (pos? actual) (even? actual)))
(fact 2 => twosie)

Here is the definition of a simple version of the roughly checker:

(defchecker roughly [expected delta] (checker [actual] (and (number? actual) ...))) (fact 1.1 => (roughly 1 0.2))

See also (doc chatty-checker).

Like defn, but tags the variable created and the function it
refers to as checkers. This is only required if the checker is
to be used in the left-hand side of a prerequisite, but it never
hurts to define checkers using this. Here is a checker for
positive even numbers:

    (defchecker twosie [actual]
       (and (pos? actual) (even? actual)))
    (fact 2 => twosie)

 Here is the definition of a simple version of the `roughly`
 checker:

   (defchecker roughly [expected delta]
      (checker [actual]
         (and (number? actual)
              ...)))
  (fact 1.1 => (roughly 1 0.2))

 See also `(doc chatty-checker)`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close