leanovate / gopter

GOlang Property TestER
MIT License
598 stars 40 forks source link

Have gen.Struct create shrinkable structs #47

Closed andremarianiello closed 5 years ago

andremarianiello commented 5 years ago

Currently, gen.Struct (and gen.StructPtr) create results by taking elements from field generators, and combining them into a struct, which is emitting by the struct generator. However, this struct is emitted using NoShrinker, so it cannot be shrunk. In order to get shrinkable structs, I have been manually writing Gens using DeriveGen, but it would be much nicer to be able to use the helper functions like gen.Struct, and if the default arbitrary generators gave shrinkable results as well.