new-object-tester

net.licenser.sandbox.tester

  • (new-object-tester & definitions)
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.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source net/licenser/sandbox/tester.clj:77 top

(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)))))))
Vars in net.licenser.sandbox.tester/new-object-tester: and defn fn let not-any? or some
Used in 0 other vars

Comments top

No comments for new-object-tester. Log in to add a comment.