ns alias refactoring
This commit is contained in:
parent
a59c6a1675
commit
8c13ad2d44
1 changed files with 8 additions and 8 deletions
|
@ -15,28 +15,28 @@
|
||||||
; limitations under the License.
|
; limitations under the License.
|
||||||
(ns data-test
|
(ns data-test
|
||||||
(:require
|
(:require
|
||||||
[clojure.test :as ct]
|
[clojure.test :as t]
|
||||||
[schema.core :as s]
|
[schema.core :as s]
|
||||||
[data-test.reporter :as reporter]
|
[data-test.reporter :as reporter]
|
||||||
[data-test.file-loader :as fl]))
|
[data-test.file-loader :as loader]))
|
||||||
|
|
||||||
(def TestDataSpec fl/TestDataSpec)
|
(def TestDataSpec loader/TestDataSpec)
|
||||||
|
|
||||||
(defmacro defdatatest [n bindings & body]
|
(defmacro defdatatest [n bindings & body]
|
||||||
(when ct/*load-tests*
|
(when t/*load-tests*
|
||||||
(let [namespaced-test-key# (keyword (str *ns*) (name n))]
|
(let [namespaced-test-key# (keyword (str *ns*) (name n))]
|
||||||
`(def ~(vary-meta n assoc
|
`(def ~(vary-meta n assoc
|
||||||
:test `(fn []
|
:test `(fn []
|
||||||
(doseq [data-spec# (fl/load-data-test-specs ~namespaced-test-key#)]
|
(doseq [data-spec# (loader/load-data-test-specs ~namespaced-test-key#)]
|
||||||
(let [~(symbol (first bindings)) (:input data-spec#)
|
(let [~(symbol (first bindings)) (:input data-spec#)
|
||||||
~(symbol (second bindings)) (:expectation data-spec#)
|
~(symbol (second bindings)) (:expectation data-spec#)
|
||||||
data-spec-file# (:data-spec-file data-spec#)
|
data-spec-file# (:data-spec-file data-spec#)
|
||||||
message# (new java.io.StringWriter)]
|
message# (new java.io.StringWriter)]
|
||||||
(binding [ct/*testing-contexts*
|
(binding [t/*testing-contexts*
|
||||||
(conj ct/*testing-contexts* data-spec-file#)
|
(conj ct/*testing-contexts* data-spec-file#)
|
||||||
ct/*test-out* message#]
|
t/*test-out* message#]
|
||||||
~@body)
|
~@body)
|
||||||
(reporter/write data-spec-file# data-spec# message#)
|
(reporter/write data-spec-file# data-spec# message#)
|
||||||
)))
|
)))
|
||||||
:data-spec-key namespaced-test-key#)
|
:data-spec-key namespaced-test-key#)
|
||||||
(fn [] (ct/test-var (var ~n)))))))
|
(fn [] (t/test-var (var ~n)))))))
|
||||||
|
|
Loading…
Reference in a new issue