cljs.spec/fdef

MOVED, please see cljs.spec.alpha/fdef
macroremoved v1.9.542added v1.9.14Edit
(fdef fn-sym & specs)

Source docstring:
Takes a symbol naming a function, and one or more of the following:

:args A regex spec for the function arguments as they were a list to be
  passed to apply - in this way, a single spec can handle functions with
  multiple arities
:ret A spec for the function's return value
:fn A spec of the relationship between args and ret - the
  value passed is {:args conformed-args :ret conformed-ret} and is
  expected to contain predicates that relate those values

Qualifies fn-sym with resolve, or using *ns* if no resolution found.
Registers an fspec in the global registry, where it can be retrieved
by calling get-spec with the var or full-qualified symbol.

Once registered, function specs are included in doc, checked by
instrument, tested by the runner clojure.spec.test/run-tests, and (if
a macro) used to explain errors during macroexpansion.

Note that :fn specs require the presence of :args and :ret specs to
conform values, and so :fn specs will be ignored if :args or :ret
are missing.

Returns the qualified fn-sym.

For example, to register function specs for the symbol function:

(s/fdef clojure.core/symbol
  :args (s/alt :separate (s/cat :ns string? :n string?)
               :str string?
               :sym symbol?)
  :ret symbol?)
Source code @ clojurescript:src/main/cljs/cljs/spec.cljc
(defmacro fdef
  [fn-sym & specs]
  (swap! _speced_vars conj (ns-qualify &env fn-sym))
  `(cljs.spec/def ~fn-sym (fspec ~@specs)))