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

Detect empty ranges during tree creation #462

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

mirandaconrado
Copy link

Currently, if an empty range is used as base for a strategy, the generation will fail during the call to the rand crate as it cannot sample from an empty range. This PR creates a panic during the tree construction (the soonest we can) with a descriptive message, facilitating tracking the source of the issue.

Solves #449

The panic message test pattern follows Rust's core library https://github.com/rust-lang/rust/blob/a1bad57fa59a8069a6ebb05cd6a2ae73c88b2e98/src/test/run-pass/panic-uninitialized-zeroed.rs

Copy link
Contributor

@rexmas rexmas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! thanks for the contribution!

@rexmas rexmas merged commit ca308b0 into proptest-rs:master Jun 19, 2024
5 checks passed
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.

4 participants