This repository was archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Support closure proptests #21
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The API could look something like:
#[propfuzz_closure]
fn foo() {
// set up initial state...
#[propfuzz(name = "test1")]
|param: Vec<u8>| {
// ... test
};
#[propfuzz(name = "test2")]
|#[propfuzz(strategy = "state.strategy()")] param: StateParam<'_>| {
// ... test
};
}
Internally, this could be modeled through:
- the
#[propfuzz_closure]attribute macro scanning through all the items and turning them into targets - instead of a
&mut TestRunner, pass in a&mut __PROPFUZZ_CLOSURE__foowhere__PROPFUZZ_CLOSURE__foois an autogenerated type:
struct __PROPFUZZ_CLOSURE__foo {
test1: Option<TestRunner>,
test2: Option<TestRunner>,
}
test1 and test2 provide access to individual test runners -- the Option is so that we can disable a test from running in the fuzzing context.
This is a fair bit of complexity and accordingly not very high priority unless we end up needing it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request