Skip to content
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

Enable customization of Commands.Command shrinking #740

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonaskoelker
Copy link
Contributor

The Commands user can either specify a Shrink[Command], in which
case the default List shrinker will be used to shrink sequential and
parallel commands, or the user can specify those shrinks directly, or
a mix (e.g. Shrink[Command] and Shrink[List[List[Command]]]).

The `Commands` user can either specify a `Shrink[Command]`, in which
case the default `List` shrinker will be used to shrink sequential and
parallel commands, or the user can specify those shrinks directly, or
a mix (e.g. `Shrink[Command]` and `Shrink[List[List[Command]]]`).
@jonaskoelker
Copy link
Contributor Author

This is one part of #632, split out into its own PR. See also #739.

@jonaskoelker
Copy link
Contributor Author

I'd be happy to add documentation and tests; however, I'm not sure exactly what your documentation requirements are, and I think the tests belong in the same file as the one created by #739, and that seems like the least fun kind of merge commit :-) so let's land #739 first?

@ashawley
Copy link
Contributor

Can you define an implicit val shrinkActions in theProperties test class to replace the one defined in Commands and have complete control of the shrinking of actions and thus commands?

Base automatically changed from master to main March 26, 2021 18:56
@jonaskoelker
Copy link
Contributor Author

Can you define an implicit val shrinkActions in theProperties test class to replace the one defined in Commands and have complete control of the shrinking of actions and thus commands?

The main obstacle is that the case class Actions is private. That can be changed. So is shrinkActions and that can be changed too. However, I think one of the value propositions of the Commands module is that it does the command sequence shrinking for me—I as a user don't have to implement shrinking of sequences of commands myself, only of individual commands (and states). If I override shrinkActions I'll have to reimplement the shrinking of command sequences.

Maybe what you had in mind is making shrinkActions customizable, but making the default implementation available, maybe with state and command shrinking customizable? But isn't that exactly what this PR does, except it doesn't make shrinkActions overridable? If what you want is this PR plus a customizable shrinkActions, I think the best path is via two PRs: this one, plus one that makes shrinkActions customizable.

If you insist I'll make a PR which just overrides shrinkActions, but please consider whether that's really what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants