diff --git a/feature-spec-alpha/babashka/impl/spec.clj b/feature-spec-alpha/babashka/impl/spec.clj index 96fa4b3b..7f1061a2 100644 --- a/feature-spec-alpha/babashka/impl/spec.clj +++ b/feature-spec-alpha/babashka/impl/spec.clj @@ -106,7 +106,7 @@ '*instrument-enabled* test/instrument-enabled-var 'with-instrument-disabled (copy-var test/with-instrument-disabled 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]] #_:clj-kondo/ignore diff --git a/src/babashka/impl/clojure/spec/test/alpha.clj b/src/babashka/impl/clojure/spec/test/alpha.clj index 6d668946..bf917915 100644 --- a/src/babashka/impl/clojure/spec/test/alpha.clj +++ b/src/babashka/impl/clojure/spec/test/alpha.clj @@ -120,7 +120,7 @@ (drop-while plumbing?)) elems))) -(defn spec-checking-fn +(defn spec-checking-fn* ;; renamed to we're forced to go through SCI var below [v f fn-spec] (let [fn-spec (@#'s/maybe-spec fn-spec) conform! (fn [v role spec data args] @@ -149,6 +149,9 @@ (.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 [v spec] (ex-info (str "Fn at " v " is not spec'ed.") @@ -179,7 +182,7 @@ ospec (or (instrument-choose-spec spec s opts) (throw (no-fspec v spec))) 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)) (swap! instrumented-vars assoc v {:raw to-wrap :wrapped checked}) (->sym v)))))