form-for-testing-namespaces

leiningen.test

  • (form-for-testing-namespaces namespaces result-file)
  • (form-for-testing-namespaces namespaces test-package result-file)
Return a form that when eval'd in the context of the project will test
each namespace and print an overall summary.

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 leiningen/test.clj:18 top

(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))))
Vars in leiningen.test/form-for-testing-namespaces: defn -> = apply concat doseq find-ns fn let list ns-resolve pr-str require seq shutdown-agents vector when-not with-open
Used in 0 other vars

Comments top

No comments for form-for-testing-namespaces. Log in to add a comment.