From 84fc8f0f4fe4b153d05e21dc986e675134b8de6b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 29 Jul 2021 08:58:06 -0600 Subject: [PATCH] Don't let people retry randomized tests Co-Authored-By: Antonio Scandurra --- gpui_macros/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gpui_macros/src/lib.rs b/gpui_macros/src/lib.rs index 7de36f66ee..409457f698 100644 --- a/gpui_macros/src/lib.rs +++ b/gpui_macros/src/lib.rs @@ -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());