Don't let people retry randomized tests

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo
2021-07-30 09:50:28 -07:00
committed by Max Brunsfeld
co-authored by Antonio Scandurra
parent 6efadd19dd
commit 84fc8f0f4f
+6
View File
@@ -52,6 +52,12 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
}
let mut inner_fn = parse_macro_input!(function as ItemFn);
if max_retries > 0 && num_iterations > 1 {
return TokenStream::from(
syn::Error::new_spanned(inner_fn, "retries and randomized iterations can't be mixed")
.into_compile_error(),
);
}
let inner_fn_attributes = mem::take(&mut inner_fn.attrs);
let inner_fn_name = format_ident!("_{}", inner_fn.sig.ident);
let outer_fn_name = mem::replace(&mut inner_fn.sig.ident, inner_fn_name.clone());