Creates a new tester combined from a set of black and whitelists.
Usage: (new-tester (whitelist (function-matcher 'println)))
This returns a tester that takes 2 arguments a function, and a namespace.
(defn new-tester
"Creates a new tester combined from a set of black and whitelists.
Usage: (new-tester (whitelist (function-matcher 'println)))
This returns a tester that takes 2 arguments a function, and a namespace."
[& definitions]
(let [{wl :whitelist bl :blacklist} (reduce #(assoc %1 (:type %2)
(conj (get %1 (:type %2))
(:tests %2))) {} definitions)]
(fn
([]
[new-tester definitions])
([form nspace]
(let [forms (if (= (type form) clojure.lang.Var) (list form) (fn-seq form))]
(if (empty? forms)
true
(let [r (map
(fn [f]
(and
(run-list some (conj wl (namespace-matcher nspace)) f)
(run-list not-any? bl f)))
forms)]
(and (not (empty? r)) (every? true? r)))))))))
Comments top
No comments for new-tester. Log in to add a comment.