Skip to content

test: share proptest helpers through a proptesting module under the testing feature (1/3) - #7891

Open
cylewitruk-stacks wants to merge 1 commit into
stacks-network:mainfrom
cylewitruk-stacks:test/proptesting/pr/shared-module
Open

cylewitruk-stacks wants to merge 1 commit into
stacks-network:mainfrom
cylewitruk-stacks:test/proptesting/pr/shared-module

Conversation

@cylewitruk-stacks

Copy link
Copy Markdown
Contributor

Description

Clarity's shared property-test helpers were hard to reuse:

  • They were #[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.rs had 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 against docs/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:

  • Helpers move into a single vm::tests::proptesting module, available to dependent crates through clarity's testing feature: proptesting::run (snippet execution), proptesting::literals (values as Clarity source) and proptesting::strategies::{bitcoin, names, principals, snippets, types, values}
  • proptest is now an optional dependency enabled by testing
  • Strategies used by a single test move back into that test: post-condition snippets to post_conditions.rs, trait shapes to traits.rs; four post-condition helpers that were never used are removed
  • Shared strategies use *_strategy naming (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

  • n/a

Additional info (benefits, drawbacks, caveats)

First of a three-PR stack: this → deduplicate strategies → typed-value generators.

Checklist

  • Test coverage for new or modified code paths (no behaviour change; existing tests pass)
  • For new Clarity features or consensus changes, add property tests (n/a)
  • Changelog fragment(s) or "no changelog" label added
  • Required documentation changes (docs/property-testing.md)
  • New clarity functions have corresponding PR in clarity-benchmarking repo (n/a)

@cylewitruk-stacks cylewitruk-stacks changed the title test: share proptest helpers through a proptesting module under the testing feature test: share proptest helpers through a proptesting module under the testing feature Nov 22, 2026
@cylewitruk-stacks cylewitruk-stacks changed the title test: share proptest helpers through a proptesting module under the testing feature test: share proptest helpers through a proptesting module under the testing feature (1/3) Nov 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant