improved encapsulation

This commit is contained in:
jem 2019-05-29 19:09:01 +02:00
parent 4e29ea49b5
commit ce25f94fc3
2 changed files with 11 additions and 3 deletions

View file

@ -30,6 +30,10 @@
TestDataSpec TestDataSpec
{:data-spec-file s/Str})) {:data-spec-file s/Str}))
(s/defn data-spec-file :- s/Str
[runtime-test-data-spec :- RuntimeTestDataSpec]
(:data-spec-file runtime-test-data-spec))
(s/defn read-test-data-spec :- TestDataSpec (s/defn read-test-data-spec :- TestDataSpec
[resource-url :- s/Str] [resource-url :- s/Str]
(aero/read-config resource-url)) (aero/read-config resource-url))

View file

@ -18,15 +18,19 @@
[clojure.test :as t] [clojure.test :as t]
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.stacktrace :as stack] [clojure.stacktrace :as stack]
[schema.core :as s])) [schema.core :as s]
[data-test.loader :as loader]))
(def ^:dynamic (def ^:dynamic
*data-test-report-context* nil) *data-test-report-context* nil)
(def ^:dynamic
*target-dir* "target/datatest/")
(s/defn write-data-test-output (s/defn write-data-test-output
[m] [m]
(let [data-spec-file (:data-spec-file *data-test-report-context*) (let [data-spec-file (loader/data-spec-file *data-test-report-context*)
output-file (str "target/datatest/" data-spec-file)] output-file (str *target-dir* data-spec-file)]
(io/make-parents output-file) (io/make-parents output-file)
(spit output-file (merge (spit output-file (merge
{:test-event m} {:test-event m}