Can clojure.spec'd be included in a generic test suite? I know that we can register specifications and directly specification functions .
(ns foo (:require [clojure.spec :as s] [clojure.spec.test :as stest])) (defn average [list-sum list-count] (/ list-sum list-count)) (s/fdef average :args (s/and (s/cat :list-sum float? :list-count integer?)
And later, if I want to run generative tests against this spec function, I can use stest/check
.
=> (stest/check `average) ({:spec #object[clojure.spec$fspec_impl$reify__14282 0x68e9f37c " clojure.spec$fspec_impl$reify__14282@68e9f37c "], :clojure.spec.test.check/ret {:result true, :num-tests 1000, :seed 1479587517232}, :sym edgar.core.analysis.lagging/average})
But i) to include these test runs in my overall test suite? I am thinking about the integration of clojure.test
, which test.check has . The closest I can see ii) is stest/instrument
(see here ). But it looks like we just turn on the check for repl. Not quite what I want. In addition, iii) are specification functions registered?
(defspec foo-test 100 ;; NOT this
source share