Created
September 12, 2016 12:33
-
-
Save tgk/be0325e7b78bc692ad6c85ef6aca818d to your computer and use it in GitHub Desktop.
A very small script for running spec tests. I have a lein alias for running the main function and that works quite well.
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
(ns spec-test | |
(:require [clojure.pprint] | |
[clojure.spec.test] | |
[clojure.tools.namespace.repl :refer (refresh)])) | |
(defn run-analysis | |
[] | |
(clojure.spec.test/instrument) | |
(let [results (clojure.spec.test/check) | |
failures (remove (comp true? :result :clojure.spec.test.check/ret) results)] | |
(clojure.pprint/print-table | |
[:success? :symbol :seed] | |
(for [result results] | |
{:success? (true? (get-in result [:clojure.spec.test.check/ret :result])) | |
:symbol (get result :sym) | |
:seed (get-in result [:clojure.spec.test.check/ret :seed])})) | |
(System/exit (if (seq failures) 1 0)))) | |
(defn -main | |
[& args] | |
(refresh :after 'spec-test/run-analysis)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment