-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add proptest-impl
feature to zebra-state
#2529
Add proptest-impl
feature to zebra-state
#2529
Conversation
This prepares the `zebra-state` crate to be able to export some test-specific helper types and functions.
33bf540
to
6279dfa
Compare
This comment has been minimized.
This comment has been minimized.
A separate module to contain the `Prepare` trait, since it's required by some prop-test strategies and therefore can't be in the `tests` module.
Use the same trait but placed in a new module that's accessible based on the feature flag.
It was obsoleted by the new copy in the `arbitrary` module.
6279dfa
to
1b84d40
Compare
Prepare for it to be accessible in some test modules.
Import the function directly, instead of just its containing module.
Create a new module for the strategy functions that are only used internally.
1b84d40
to
71e9a6b
Compare
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.
It looks like the new arbitrary.rs file is missing from this branch?
Oops, my bad 😓 Fixed now.
Reviewable status: 0 of 13 files reviewed, 1 unresolved discussion (waiting on @jvff and @teor2345)
zebra-state/src/service/arbitrary.rs, line 151 at r1 (raw file):
Previously, teor2345 (teor) wrote…
It's a bit confusing mixing
#[cfg(test)]
and#[cfg(any(test, feature = "proptest-impl"))]
code in the same module.Can you move these functions and their imports to a new
tests::setup
module instead?
Done.
* Draft CHANGELOG for Zebra 1.0.0-alpha.14 * Add PR #2533 to CHANGELOG * Apply suggestions from code review Co-authored-by: teor <[email protected]> * Remove entry about updating the changelog * move #2497 * add #2529 * Add a missing space * Add #2458, #2525, #2486, #2542 and #2539 to CHANGELOG Co-authored-by: teor <[email protected]> Co-authored-by: Deirdre Connolly <[email protected]>
Motivation
The
zebra-state
crate was previously already using#[cfg(feature = "proptest-impl")]
feature gates, but it didn't have theproptest-impl
feature defined inCargo.toml
. This became necessary as part of the work for #1334, because having azebra_state::init_test
helper function to be used for tests on other crates would simplify some code.Solution
The
proptest-impl
feature was added, and it enables thezebra-test
and theproptest
dependencies with it.Unfortunately, just adding the feature breaks the build, because the code had partial usages of the feature already. Therefore, some refactoring was needed to fix the errors and also eliminate warnings.
Review
@teor2345 had already started looking at the #2519 draft PR for #1334.
Reviewer Checklist
Follow Up Work
A PR after this one will add the
zebra_state::init_test
helper function and refactor some other crates' test code to use it.This change is