-
Couldn't load subscription status.
- Fork 1.4k
Add zio-test-refined module #4583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Gen.weighted(Gen.char(48, 57) -> 10) | ||
|
|
||
| private val whitespaceChars: Seq[Char] = | ||
| (Char.MinValue to Char.MaxValue).filter(_.isWhitespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. May be move these to Gen companion object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
In addition to just more instances, the biggest thing I see here is we may want to split out the Refined support from the automatic derivation. Right now these are bundles together so it is great if you want to automatically derive generators for refined types, but if you want to manually put more complex ones together from the simpler ones to build in some custom logic it is a little clunky because you have to unpack the DeriveGen instances.
I think we could have the same functionality here and make it more flexible if we first defined a set of constructors for Gen values for refined types and then used these to construct DeriveGen instances for those types.
I will merge this now and open separate issues to follow up on this.
|
Thanks @adamgfraser @pierangeloc and myself had a discussion about separating out the logic to only return Gen and then have separate refined module that later lifts them to refined types. But it suddenly became a bigger change for an initial Thanks for merging. Really looking forward to use the module in production. |
The module currently makes use of
DeriveGen; allowing users to callDeriveGen[Refined[String, NonEmpty]]to get aGen[Refined[String, NonEmpty]]