Fork me on GitHub
#clojure-spec
<
2017-09-08
>
ikitommi12:09:25

we are running our spec libs tests also with :advanced cljs optimizations. Seems that the cljs.spec.test.alpha/instrument doesn’t work under it. Is there a way to enable it?

jjttjj22:09:05

let's say the spec decimal-in defined here: https://github.com/SparkFund/useful-specs/blob/master/src/specs/number.clj#L24 is exactly what i need, except that the generator it comes with results in a bigdec, where I need a double. Is there a way to make a new generator that just coerces the output of an existing generator?

jjttjj22:09:23

basically i just need a spec and a generator for a double with a specified precision and scale

Alex Miller (Clojure team)22:09:22

Make a spec with s/decimal-in

Alex Miller (Clojure team)22:09:50

Then make a spec that wraps it with s/with-gen

Alex Miller (Clojure team)22:09:37

If you want build on the existing gen, use gen/fmap over the s/gen of the first spec