File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 (list x)
2222 x))
2323
24+ (defn- fn-spec-name?
25+ [s]
26+ (symbol? s))
27+
2428(defmacro enumerate-namespace
2529 " Given a symbol naming an ns, or a collection of such symbols,
2630returns the set of all symbols naming vars in those nses."
@@ -175,4 +179,16 @@ Returns a collection of syms naming the vars unstrumented."
175179 ([f spec opts]
176180 `(let [opts# ~opts]
177181 (validate-check-opts opts#)
178- (check-1 nil ~f ~spec opts#))))
182+ (check-1 nil ~f ~spec opts#))))
183+
184+ (defmacro checkable-syms
185+ " Given an opts map as per check, returns the set of syms that
186+ can be checked."
187+ ([]
188+ `(checkable-syms nil ))
189+ ([opts]
190+ `(let [opts# ~opts]
191+ (validate-check-opts opts#)
192+ (reduce conj #{}
193+ '[~@(filter fn-spec-name? (keys @s/registry-ref))
194+ ~@(keys (:spec opts))]))))
Original file line number Diff line number Diff line change @@ -226,15 +226,6 @@ with explain-data + ::s/failure."
226226 [opts]
227227 (assert (every? ident? (keys (:gen opts))) " check :gen expects ident keys" ))
228228
229- (defn checkable-syms
230- " Given an opts map as per check, returns the set of syms that
231- can be checked."
232- ([] (checkable-syms nil ))
233- ([opts]
234- (validate-check-opts opts)
235- (reduce into #{} [(filter fn-spec-name? (keys (s/registry )))
236- (keys (:spec opts))])))
237-
238229(defn check
239230 " Run generative tests for spec conformance on vars named by
240231sym-or-syms, a symbol or collection of symbols. If sym-or-syms
@@ -394,6 +385,8 @@ key with a count for each different :type of result."
394385 (s/fspec
395386 :args (s/cat :x int?)
396387 :ret int?))
388+
389+ (m/checkable-syms )
397390 )
398391
399392
You can’t perform that action at this time.
0 commit comments