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-object-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-object-tester definitions])
([object method]
(let [method (symbol method)
c (type object)]
(and
(run-list not-any? bl c)
(run-list not-any? bl method)
(or
(run-list some wl object)
(run-list some wl c)
(run-list some wl method)
false)))))))
Comments top
No comments for new-object-tester. Log in to add a comment.