Fork me on GitHub
#clojure-spec
<
2021-04-20
>
cap10morgan16:04:49

Is it expected behavior that s/valid? needs the test.check library and needs to construct a gen for every (nested) spec it's validating against? seems counterintuitive to me, but maybe I'm missing something.

kenny16:04:52

It's only necessary when checking fspecs.

cap10morgan16:04:54

I'm getting "Unable to construct gen at: ..." errors when calling (s/valid? ::my-spec my-val)

kenny16:04:25

I suspect ::my-spec uses s/fspec.

cap10morgan16:04:08

the one it's erroring on currently looks like this: (s/def ::log-file #(instance? File %))

Alex Miller (Clojure team)16:04:52

I agree with kenny, that this seems like what you'd see with s/fspec

Alex Miller (Clojure team)16:04:11

and generally, s/valid? will not require test.check unless you are gen'ing

cap10morgan16:04:44

hmm... ok. yeah, commenting out my two fdef's eliminated it. thanks!