metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.44k stars 204 forks source link

Add :gen/return support in malli.generator #933

Closed radhikalism closed 10 months ago

radhikalism commented 10 months ago

Resolves #932.

Adds idiom for :gen/return x in properties, just like clojure.test.check.generators/return x. It has similar effect to more indirect workarounds previously like :gen/elements [x] or :gen/gen (gen/return x) or :gen/fmap (constantly x).

Combining :gen/return and :gen/fmap works similarly to combining :gen/return and :gen/elements. Returning nil from :gen/return nil is supported.

ikitommi commented 10 months ago

Piilomaan Pikkuaasi 👍

ikitommi commented 10 months ago

Thanks!