cljs.spec.test/check

MOVED, please see cljs.spec.test.alpha/check
macroremoved v1.9.542added v1.9.183Edit
(check)
(check sym-or-syms)
(check sym-or-syms opts)

Source docstring:
Run generative tests for spec conformance on vars named by
sym-or-syms, a symbol or collection of symbols. If sym-or-syms
is not specified, check all checkable vars. If a symbol identifies a
namespace then all symbols in that namespace will be enumerated.

The opts map includes the following optional keys, where stc
aliases clojure.test.check:

::stc/opts  opts to flow through test.check/quick-check
:gen        map from spec names to generator overrides

The ::stc/opts include :num-tests in addition to the keys
documented by test.check. Generator overrides are passed to
spec/gen when generating function args.

Returns a lazy sequence of check result maps with the following
keys

:spec       the spec tested
:sym        optional symbol naming the var tested
:failure    optional test failure
::stc/ret   optional value returned by test.check/quick-check

The value for :failure can be any exception. Exceptions thrown by
spec itself will have an ::s/failure value in ex-data:

:check-failed   at least one checked return did not conform
:no-args-spec   no :args spec provided
:no-fn          no fn provided
:no-fspec       no fspec provided
:no-gen         unable to generate :args
:instrument     invalid args detected by instrument
Source code @ clojurescript:src/main/cljs/cljs/spec/test.cljc
(defmacro check
  ([]
   `(check '~(checkable-syms*)))
  ([sym-or-syms]
   `(check ~sym-or-syms nil))
  ([sym-or-syms opts]
   (let [syms (sym-or-syms->syms (eval sym-or-syms))
         opts-sym (gensym "opts")]
     `(let [~opts-sym ~opts]
        [~@(->> syms
             (filter (checkable-syms* opts))
             (map
               (fn [sym]
                 (do `(check-1 '~sym nil nil ~opts-sym)))))]))))