This adds the ability to add custom strategies to parameters of a #[property_test] function:
#[property_test]
fn test_something(x: i32, #[strategy = "[0-9]*"] s: String) {
// test body
}
This adds a second code path to codegen:
if there are no custom strategies, we use the old code path which internally uses an Arbitrary impl with fully spelled out types (i.e. no boxing)
if there is one or more custom strategy, we no longer have enough information to spell out the full type of the Strategy, since macros run before typechecking. So we just fallback to BoxedStrategy<Self>
I've tried to retain span info, so error messages should appear at the correct place if you do things like add 2 strategies to a field, or use invalid syntax. For other stuff (e.g. passing non-strategies) we rely on rustc
This adds the ability to add custom strategies to parameters of a
#[property_test]
function:This adds a second code path to codegen:
Arbitrary
impl with fully spelled out types (i.e. no boxing)Strategy
, since macros run before typechecking. So we just fallback toBoxedStrategy<Self>
I've tried to retain span info, so error messages should appear at the correct place if you do things like add 2 strategies to a field, or use invalid syntax. For other stuff (e.g. passing non-strategies) we rely on rustc