prepare for multi-test run

This commit is contained in:
jem 2019-05-21 18:41:15 +02:00
parent 149f1afd90
commit 22227ba979
2 changed files with 3 additions and 4 deletions

View file

@ -21,7 +21,7 @@
(s/defn test-with-data (s/defn test-with-data
[test-name :- s/Keyword] [test-name :- s/Keyword]
(runner/run-test (runner/create-test-runner test-name))) (runner/run-tests (runner/create-test-runner test-name)))
(defmacro defdatatest [name & body] (defmacro defdatatest [name & body]
'(do '(do

View file

@ -32,7 +32,7 @@
(defprotocol RunTest (defprotocol RunTest
"Protocol for data driven tests" "Protocol for data driven tests"
(name-prefix [dda-test]) (name-prefix [dda-test])
(run-test [dda-test]) (run-tests [dda-test])
) )
(s/defn dispatch-by-name :- s/Keyword (s/defn dispatch-by-name :- s/Keyword
@ -60,7 +60,6 @@
(s/defn load-test-data (s/defn load-test-data
[file-prefix :- s/Str] [file-prefix :- s/Str]
(let [file-path (str file-prefix ".edn")] (let [file-path (str file-prefix ".edn")]
(println file-path)
(read-data (read-data
(io/resource file-path)))) (io/resource file-path))))
@ -68,7 +67,7 @@
RunTest RunTest
(name-prefix [_] (name-prefix [_]
(data-file-prefix (:name _))) (data-file-prefix (:name _)))
(run-test [_] (run-tests [_]
(let [testdata (load-test-data (data-file-prefix (:name _))) (let [testdata (load-test-data (data-file-prefix (:name _)))
{:keys [input expectation]} testdata] {:keys [input expectation]} testdata]
(data-test _ input expectation)))) (data-test _ input expectation))))