Return a form that when eval'd in the context of the project will test
each namespace and print an overall summary.
(defn form-for-testing-namespaces
"Return a form that when eval'd in the context of the project will test
each namespace and print an overall summary."
([namespaces result-file]
(form-for-testing-namespaces namespaces 'clojure.test result-file))
([namespaces test-package result-file]
`(do
(require '~test-package)
(doseq [n# '~namespaces]
(require n#))
(let [resolver# (fn [fname#]
(ns-resolve
(find-ns '~test-package) fname#))
summary# (apply (resolver# ~''run-tests) '~namespaces)]
(when-not (= "1.5" (System/getProperty "java.specification.version"))
(shutdown-agents))
(with-open [w# (-> (java.io.File. ~result-file)
(java.io.FileOutputStream.)
(java.io.OutputStreamWriter.))]
(.write w# (pr-str summary#))))
(System/exit 0))))
Comments top
No comments for form-for-testing-namespaces. Log in to add a comment.