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

Generator for pointers (PtrTo and Ptr) do not shrink pointer to nil #107

Closed
steffnova opened this issue May 17, 2023 · 0 comments · Fixed by #108
Closed

Generator for pointers (PtrTo and Ptr) do not shrink pointer to nil #107

steffnova opened this issue May 17, 2023 · 0 comments · Fixed by #108
Labels
enhancement New feature or request

Comments

@steffnova
Copy link
Owner

Ptr generator can generate either nil pointer or pointer to a type defined by it's "element" generator:

// This will generate either <*int>(nil) or <*int>(10) (or any other int value)
generator.Ptr(generator.Int())

However Ptr doesn't provide shrinker that can shrink pointer to nil. (it only shrinks the value that it points to).

PtrTo generator on the other hand will always generate a non-nil pointer.

It makes sense to merge these two generators into a single generator and add aforementioned shrinking capabilities.

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

Successfully merging a pull request may close this issue.

1 participant