Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active November 3, 2018 02:39
Show Gist options
  • Save mfikes/19e8d1983c9c594ada8ca2a21448c77a to your computer and use it in GitHub Desktop.
Save mfikes/19e8d1983c9c594ada8ca2a21448c77a to your computer and use it in GitHub Desktop.
Patching check
(ns repro.patch)
#?(:cljs (defn checkable-syms*
([]
(checkable-syms* nil))
([opts]
(reduce into #{}
[(filter js/cljs.spec.test.alpha$macros.fn_spec_name_QMARK_ (keys @js/cljs.spec.alpha$macros.registry_ref))
(keys (:spec opts))]))))
#?(:cljs (defmacro fix-check []
(when (exists? js/PLANCK_VERSION)
(set! js/cljs.spec.test.alpha$macros.checkable_syms_STAR_ checkable-syms*)))
:clj (defmacro fix-check []))
(ns repro.patch
(:require-macros repro.patch))
(ns repro.weird
(:require
[repro.patch] ;; NEW LINE
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as stest]
[clojure.test :as t :refer [deftest is testing]]
[clojure.test.check]
;; [speculative.test-test]
;; [speculative.core-test]
[clojure.test]))
(repro.patch/fix-check) ;; NEW LINE
(defn foo [n]
"ret")
(s/fdef foo
:args (s/cat :n number?)
:ret string?)
(defn hmm []
(println "HMM" (stest/check `foo {:clojure.test.check/opts {:num-tests 42}})))
(defn -main [& args]
(hmm)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment