File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 224
224
(defn- gensub
225
225
[spec overrides path rmap form]
226
226
; ;(prn {:spec spec :over overrides :path path :form form})
227
- (let [spec (specize spec)]
227
+ (let [spec (c/or (get overrides spec) spec)
228
+ spec (specize spec)]
228
229
(if-let [g (c/or (get overrides path) (gen* spec overrides path rmap))]
229
230
(gen/such-that #(valid? spec %) g 100 )
230
231
(throw (js/Error. (str " Unable to construct gen at: " path " for: " (abbrev form)))))))
231
232
232
233
(defn gen
233
234
" Given a spec, returns the generator for it, or throws if none can
234
235
be constructed. Optionally an overrides map can be provided which
235
- should map paths (vectors of keywords) to generators. These will be
236
- used instead of the generators at those paths. Note that parent
237
- generator (in the spec or overrides map) will supersede those of any
238
- subtrees. A generator for a regex op must always return a
239
- sequential collection (i.e. a generator for s/? should return either
240
- an empty sequence/vector or a sequence/vector with one item in it)"
236
+ should map spec names or paths (vectors of keywords) to
237
+ generators. These will be used instead of the generators at those
238
+ names/paths. Note that parent generator (in the spec or overrides
239
+ map) will supersede those of any subtrees. A generator for a regex
240
+ op must always return a sequential collection (i.e. a generator for
241
+ s/? should return either an empty sequence/vector or a
242
+ sequence/vector with one item in it)"
241
243
([spec] (gen spec nil ))
242
244
([spec overrides] (gensub spec overrides [] {::recursion-limit *recursion-limit*} spec)))
243
245
You can’t perform that action at this time.
0 commit comments