Last active
August 29, 2015 14:05
-
-
Save Kungi/6c2b9d8d02b397d958c2 to your computer and use it in GitHub Desktop.
fntest 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro build-test-call [nses format to-file output-file] | |
(let [format-fn (cond (= format "tap") | |
'clojure.test.tap/with-tap-output | |
(= format "junit") | |
'clojure.test.junit/with-junit-output | |
:else 'identity)] | |
(if to-file | |
`(quote (with-open [results# | |
(java.io.FileWriter. ~output-file)] | |
(binding [clojure.test/*test-out* results#] | |
('~format-fn (apply clojure.test/run-tests '~nses))))) | |
`(quote ('~format-fn (apply clojure.test/run-tests ~nses)))))) | |
(defn clojure-test-tests | |
"Invokes the clojure.test test suite in the remote Clojure." | |
[nses {:keys [format to-file output-file]}] | |
(println "Running clojure.test tests...") | |
(println "Testing namespaces in container:" nses) | |
(if to-file | |
(println "Writing to file " output-file)) | |
(println (str (cond (= format "tap") | |
"Producing TAP output" | |
(= format "junit") | |
"Producing junit output"))) | |
(execute (pr-str (backtick/template (apply require '~nses)))) | |
(let [call (build-test-call nses format to-file output-file)] | |
(println "Executing:" call) | |
(execute (pr-str (backtick/template | |
(clojure.test/successful? | |
~call)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment