added bindings

pull/1/head
jem 5 years ago
parent 9503aeddaf
commit 56276f2c18

@ -26,15 +26,15 @@
[test-name :- s/Keyword]
(runner/run-tests (runner/create-test-runner test-name)))
(defmacro defdatatest [n & body]
(defmacro defdatatest [n bindings & body]
(when ct/*load-tests*
(let [namespaced-test-key# (keyword (str *ns*) (name n))
file-prefix# (fl/data-test-spec-file-prefix namespaced-test-key#)]
`(def ~(vary-meta n assoc
:test `(fn []
(let [testdata# (fl/load-test-data ~file-prefix#)
~(symbol 'input) (:input testdata#)
~(symbol 'expectation) (:expectation testdata#)]
~(symbol (first bindings)) (:input testdata#)
~(symbol (second bindings)) (:expectation testdata#)]
~@body))
:data-spec-prefix file-prefix#)
(fn [] (ct/test-var (var ~n)))))))

@ -38,7 +38,9 @@
(is (sut/test-with-data ::should-test-with-data-record-version)))
; ---------------------------- macro -----------------------------
(sut/defdatatest should-test-with-data-macro-version (is (= input expectation)))
(sut/defdatatest should-test-with-data-macro-version [input expectation]
(is (= input expectation)))
(macroexpand-1 '(sut/defdatatest should-test-with-data-macro-version (is (= 1 1))))

Loading…
Cancel
Save