1use proc_macro::TokenStream;
2use quote::quote;
3use syn::{ItemFn, parse_macro_input};
4
5#[proc_macro_attribute]
9pub fn async_test(_attr: TokenStream, item: TokenStream) -> TokenStream {
10 let input = parse_macro_input!(item as ItemFn);
11 let output = quote! {
12 #[cfg_attr(feature = "tokio", tokio::test)]
13 #[cfg_attr(all(any(feature = "smol"), not(feature = "tokio")), apply(test!))]
14 #input
15 };
16 output.into()
17}
18
19#[proc_macro_attribute]
23pub fn async_executor(_attr: TokenStream, item: TokenStream) -> TokenStream {
24 let input = parse_macro_input!(item as ItemFn);
25 let output = quote! {
26 #[cfg_attr(feature = "tokio", tokio::main)]
27 #[cfg_attr(all(any(feature = "smol"), not(feature = "tokio")), macro_rules_attribute::apply(smol_macros::main!))]
28 #input
29 };
30 output.into()
31}