This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-09
Channels
- # announcements (1)
- # arachne (1)
- # beginners (34)
- # boot (5)
- # calva (68)
- # cider (34)
- # cljs-dev (1)
- # clojure (36)
- # clojure-italy (8)
- # clojure-spec (16)
- # clojure-uk (58)
- # clojurescript (29)
- # cursive (2)
- # datascript (9)
- # datomic (3)
- # emacs (10)
- # figwheel (1)
- # figwheel-main (11)
- # fulcro (33)
- # luminus (5)
- # mount (2)
- # nrepl (42)
- # off-topic (3)
- # other-languages (2)
- # parinfer (3)
- # perun (4)
- # prelude (3)
- # re-frame (6)
- # reagent (5)
- # shadow-cljs (23)
- # sql (37)
- # testing (1)
Sean is correct. s/gen takes a spec object. A predicate symbol or function is not a spec object. Invoking s/spec with a predicate will expand into a qualified symbolic spec and pass it through spec*, yielding a spec object
So (s/spec any?) or you can do the work of the spec expander and do (s/spec* `any?)
Quick question: any way to supply a seed to gen/sample
?
I want to do some performance testing / benchmarking. Hence getting a predictable sample is critical
@mattmorten It sounds like you really need to provide your own overridden generators that produce the same sequence over and over again?
Hmmm. That would involve a lot of duplication. In my test ns, I have 20+ lines of generator code to produce a complex data-structure in my app. I'm very happy with it. I'd rather say "give me seed 1 of this generator" than go back and write duplicate generators for each of my (many, very nested) attributes that produce a constant value
Why doesn’t spec/assert let me set my own message, seems like an optional 3rd arg would be really convenient
@seancorfield @alexmiller alright, thanks. Now that this is clear I’ll change those
Found a new bug:
speculative.specs=> (s/def ::or-spec (s/with-gen (s/or :vector vector) #(s/gen (s/spec vector?))))
:speculative.specs/or-spec
speculative.specs=> (s/valid? ::or-spec [1 2 3])
false
fixed in latest
I bumped into another one, but this might be related, so I’ll wait for this one to be resolved
You have vector in the spec, not vector?
Not sure that’s the cause but seems like a thing to fix first