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

Running out of drawn bits/failed to find suitable value in 5 tries #74

Open
varungandhi-src opened this issue Dec 20, 2024 · 3 comments
Labels

Comments

@varungandhi-src
Copy link

Reproducer repo: https://github.com/varungandhi-src/rapidbug

I've spent a few hours minimizing this from what I have in a work context. It looks like catching a panic inside rapid.Check interferes with test minimization.

varungandhi-src/rapidbug@6d30172

^ As indicated in the linked commit, avoiding require.NotPanics() (at least in the above case) fixes the issue.

Can you clarify if this is expected behavior/a known limitation, or if this is a bug?

@flyingmutant
Copy link
Owner

Rapid internally uses panics to signal various special conditions that arise during execution. These panics are not supposed to be caught by the user code.

It is probably best to avoid using things like require.NotPanics() in rapid tests. Rapid by default ensures that all tests do not panic; helpers that recover from panics do not add anything useful on top (but can add some problems).

@varungandhi-src
Copy link
Author

varungandhi-src commented Dec 23, 2024

Thanks, that makes sense. I did read the code involving the invalidData type being used while panicking, as well as the pattern-matching on it, but I didn't quite connect the dots.

Thoughts on adding a short doc comment on rapid.Check or in the README to indicate that users should not catch panics (if they're meant to indicate test failure)?

@flyingmutant
Copy link
Owner

Short doc comment sounds reasonable, can you submit a PR?

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

No branches or pull requests

2 participants