cljs.spec/spec
macro | removed v1.9.542 | added v1.9.14 | Edit |
(spec form & {:keys [gen]})
Source docstring:
Takes a single predicate form, e.g. can be the name of a predicate,
like even?, or a fn literal like #(< % 42). Note that it is not
generally necessary to wrap predicates in spec when using the rest
of the spec macros, only to attach a unique generator
Can also be passed the result of one of the regex ops -
cat, alt, *, +, ?, in which case it will return a regex-conforming
spec, useful when nesting an independent regex.
---
Optionally takes :gen generator-fn, which must be a fn of no args that
returns a test.check generator.
Returns a spec.
(defmacro spec
[form & {:keys [gen]}]
(when form
`(spec-impl '~(res &env form) ~form ~gen nil)))