Skip to content

Commit 7227141

Browse files
authored
Merge pull request #3451 from rbtcollins/async-test-helper
Fix handling of async tests
2 parents 1600b41 + 37ea4e1 commit 7227141

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rustup-macros/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use ::quote::quote;
44
use proc_macro2::TokenStream;
5-
use quote::format_ident;
65
use syn::{parse_macro_input, parse_quote, Block, Expr, ItemFn, LitStr};
76

87
/// Custom wrapper macro around `#[test]` and `#[tokio::test]`.
@@ -80,8 +79,10 @@ pub fn unit_test(
8079

8180
fn test_inner(mod_path: String, mut input: ItemFn) -> syn::Result<TokenStream> {
8281
if input.sig.asyncness.is_some() {
83-
let before_ident = format_ident!("{}::before_test_async", mod_path);
84-
let after_ident = format_ident!("{}::after_test_async", mod_path);
82+
let before_ident = format!("{}::before_test_async", mod_path);
83+
let before_ident = syn::parse_str::<Expr>(&before_ident)?;
84+
let after_ident = format!("{}::after_test_async", mod_path);
85+
let after_ident = syn::parse_str::<Expr>(&after_ident)?;
8586

8687
let inner = input.block;
8788
let name = input.sig.ident.clone();

0 commit comments

Comments
 (0)