0.4.0 permalink Arrow_down_16x16
  • (new-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:54 top

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

Comments top

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