This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-28
Channels
- # aws (5)
- # aws-lambda (1)
- # beginners (133)
- # boot (1)
- # cljsrn (1)
- # clojure (28)
- # clojure-austin (3)
- # clojure-italy (2)
- # clojure-spec (17)
- # clojure-uk (18)
- # clojurescript (38)
- # cursive (6)
- # datomic (6)
- # figwheel (1)
- # graphql (1)
- # klipse (1)
- # leiningen (1)
- # off-topic (13)
- # onyx (30)
- # re-frame (44)
- # reagent (7)
- # shadow-cljs (77)
- # spacemacs (7)
Is it intentional that the functions in clojure.spec.gen
that alias functions in clojure.test.check.generators
aren't considered generators?
Or am I doing something wrong?
(clojure.test.check.generators/generator? clojure.spec.gen.alpha/int)
seems to be returning false
In my case, I'm trying to write a spec for an 5-10 character alphabetic string with a
custom generator that uses clojure.spec.gen.alpha/char-alpha
Sampling is failing with an AssertionError
with a message of Assert failed: First arg to vector must be a generator (generator? generator)
It works fine when I use clojure.test.check.generators/char-alpha
- just seems counterintuitive that the aliased function doesn't work
that makes more sense
so i shouldn't be using them?
you can use them, you just have to be aware of that fact when mixing with plain test.check generators
and if I recall correctly, most places in clojure.spec where you can supply a custom generator, you supply a no arg function that returns a test.check generator
i just put parens around it - (gen/vector gen/char-alpha 5 10)
to (gen/vector (gen/char-alpha) 5 10)
- and it worked
cool, thanks