all works
This commit is contained in:
parent
74ada71536
commit
3d4510f1ea
2 changed files with 6 additions and 3 deletions
|
|
@ -106,7 +106,7 @@
|
||||||
'*instrument-enabled* test/instrument-enabled-var
|
'*instrument-enabled* test/instrument-enabled-var
|
||||||
'with-instrument-disabled (copy-var test/with-instrument-disabled tns)
|
'with-instrument-disabled (copy-var test/with-instrument-disabled tns)
|
||||||
'stacktrace-relevant-to-instrument (copy-var test/stacktrace-relevant-to-instrument tns)
|
'stacktrace-relevant-to-instrument (copy-var test/stacktrace-relevant-to-instrument tns)
|
||||||
'spec-checking-fn (copy-var test/spec-checking-fn tns)})
|
'spec-checking-fn test/spec-checking-fn-var})
|
||||||
|
|
||||||
#_(let [syms '[uuid gen-for-pred lazy-prim set one-of any-printable vector-distinct boolean string-alphanumeric map delay simple-type char bind symbol-ns any shuffle lazy-prims cat double char-alpha int return gen-for-name symbol quick-check char-alphanumeric choose for-all* string-ascii frequency double* generate delay-impl lazy-combinators tuple string vector large-integer keyword-ns not-empty elements sample list large-integer* keyword hash-map ratio such-that fmap char-ascii simple-type-printable lazy-combinator bytes]]
|
#_(let [syms '[uuid gen-for-pred lazy-prim set one-of any-printable vector-distinct boolean string-alphanumeric map delay simple-type char bind symbol-ns any shuffle lazy-prims cat double char-alpha int return gen-for-name symbol quick-check char-alphanumeric choose for-all* string-ascii frequency double* generate delay-impl lazy-combinators tuple string vector large-integer keyword-ns not-empty elements sample list large-integer* keyword hash-map ratio such-that fmap char-ascii simple-type-printable lazy-combinator bytes]]
|
||||||
#_:clj-kondo/ignore
|
#_:clj-kondo/ignore
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@
|
||||||
(drop-while plumbing?))
|
(drop-while plumbing?))
|
||||||
elems)))
|
elems)))
|
||||||
|
|
||||||
(defn spec-checking-fn
|
(defn spec-checking-fn* ;; renamed to we're forced to go through SCI var below
|
||||||
[v f fn-spec]
|
[v f fn-spec]
|
||||||
(let [fn-spec (@#'s/maybe-spec fn-spec)
|
(let [fn-spec (@#'s/maybe-spec fn-spec)
|
||||||
conform! (fn [v role spec data args]
|
conform! (fn [v role spec data args]
|
||||||
|
|
@ -149,6 +149,9 @@
|
||||||
(.applyTo ^clojure.lang.IFn f args)))
|
(.applyTo ^clojure.lang.IFn f args)))
|
||||||
(.applyTo ^clojure.lang.IFn f args)))))
|
(.applyTo ^clojure.lang.IFn f args)))))
|
||||||
|
|
||||||
|
;; orchestra is going to override this
|
||||||
|
(def spec-checking-fn-var (sci/copy-var spec-checking-fn* tns))
|
||||||
|
|
||||||
(defn- no-fspec
|
(defn- no-fspec
|
||||||
[v spec]
|
[v spec]
|
||||||
(ex-info (str "Fn at " v " is not spec'ed.")
|
(ex-info (str "Fn at " v " is not spec'ed.")
|
||||||
|
|
@ -179,7 +182,7 @@
|
||||||
ospec (or (instrument-choose-spec spec s opts)
|
ospec (or (instrument-choose-spec spec s opts)
|
||||||
(throw (no-fspec v spec)))
|
(throw (no-fspec v spec)))
|
||||||
ofn (instrument-choose-fn to-wrap ospec s opts)
|
ofn (instrument-choose-fn to-wrap ospec s opts)
|
||||||
checked (spec-checking-fn v ofn ospec)]
|
checked (@spec-checking-fn-var v ofn ospec)]
|
||||||
(sci/alter-var-root v (constantly checked))
|
(sci/alter-var-root v (constantly checked))
|
||||||
(swap! instrumented-vars assoc v {:raw to-wrap :wrapped checked})
|
(swap! instrumented-vars assoc v {:raw to-wrap :wrapped checked})
|
||||||
(->sym v)))))
|
(->sym v)))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue