Open
Description
Hi! I wrote a kinda rough implemenation of a #[proptest]
attribute macro in awslabs/aws-lambda-rust-runtime#111. It accepts an impl Strategy<Value = T>
, and I wanted to see if there's interest in me sending a pull request to introduce it here. It looks a bit like this:
pub fn gen_function_arn() -> impl Strategy<Value = FunctionArn> {
let expr = "arn:aws:lambda:us-east-1:[0-9]{12}:function:custom-runtime";
let arn = string_regex(expr).unwrap();
arn.prop_map(FunctionArn)
}
#[proptest(gen_function_arn())]
fn function_arn(arn: FunctionArn) {
let mut headers = HeaderMap::new();
headers.typed_insert(arn.clone());
prop_assert_eq!(headers.typed_get::<FunctionArn>(), Some(arn));
}