Fork me on GitHub
#test-check
<
2020-10-12
>
colinkahn20:10:39

is it possible to have a generator that doesn’t shrink at one level, but its children do shrink? For example:

(commit-to (gen/one-of [gen-for-case-1 gen-for-case-2]))
So once it chooses either case 1 or 2 it won’t try the other, but will shrink the things gen’d in them?

gfredericks20:10:07

Not using public functionality, I don't think

gfredericks20:10:23

A hacky idea is to have a predicate on the generated values to tell you what branch matched, and then wrap that in a such-that that insists it is something from that branch

gfredericks20:10:01

Super goofy looking, and wastes a bit of cpu, but otherwise would do what you're describing

colinkahn20:10:48

Having a hard time imagining what that would look like, but I think if it’s not standard I can just duplicate my test 😅

gfredericks21:10:46

Yeah I couldn't tell what your appetite for Weird was 🙂

😂 3