Repository navigation
test: share proptest helpers through a proptesting module under the testing feature (1/3) - #7891
Open
cylewitruk-stacks wants to merge 1 commit into
Conversation
…e available under the testing feature
proptest helpers through a proptesting module under the testing feature
3 of 5 tasks
proptest helpers through a proptesting module under the testing featureproptest helpers through a proptesting module under the testing feature (1/3)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clarity's shared property-test helpers were hard to reuse:
#[cfg(test)], so other crates couldn't use them. stackslib's sBTC tests, for example, re-implement Clarity's principal and contract-name strategies.proptest_utils.rshad grown to about 1,000 lines, mixing snippet execution, literal rendering, general strategies and strategies used by a single test. That makes existing strategies hard to find, which works againstdocs/property-testing.md's guidance to reuse them, and invites new copies.This PR makes the helpers reusable and easier to find. Follow-up PRs use that to remove the duplicates and to add type-directed value generators.
What changes:
vm::tests::proptestingmodule, available to dependent crates through clarity'stestingfeature:proptesting::run(snippet execution),proptesting::literals(values as Clarity source) andproptesting::strategies::{bitcoin, names, principals, snippets, types, values}proptestis now an optional dependency enabled bytestingpost_conditions.rs, trait shapes totraits.rs; four post-condition helpers that were never used are removed*_strategynaming (e.g.arb_simple_tx→simple_tx_strategy)No generator behaviour changes: function bodies are moved and renamed verbatim, so this reviews best with rename detection.
Applicable issues
Additional info (benefits, drawbacks, caveats)
First of a three-PR stack: this → deduplicate strategies → typed-value generators.
Checklist
docs/property-testing.md)clarity-benchmarkingrepo (n/a)