| 1 | #![allow (clippy::uninlined_format_args)] |
| 2 | |
| 3 | #[macro_use ] |
| 4 | mod macros; |
| 5 | |
| 6 | use syn::{Expr, Item}; |
| 7 | |
| 8 | #[test] |
| 9 | fn test_async_fn() { |
| 10 | let input = "async fn process() {}" ; |
| 11 | |
| 12 | snapshot!(input as Item, @r###" |
| 13 | Item::Fn { |
| 14 | vis: Visibility::Inherited, |
| 15 | sig: Signature { |
| 16 | asyncness: Some, |
| 17 | ident: "process", |
| 18 | generics: Generics, |
| 19 | output: ReturnType::Default, |
| 20 | }, |
| 21 | block: Block { |
| 22 | stmts: [], |
| 23 | }, |
| 24 | } |
| 25 | "### ); |
| 26 | } |
| 27 | |
| 28 | #[test] |
| 29 | fn test_async_closure() { |
| 30 | let input = "async || {}" ; |
| 31 | |
| 32 | snapshot!(input as Expr, @r###" |
| 33 | Expr::Closure { |
| 34 | asyncness: Some, |
| 35 | output: ReturnType::Default, |
| 36 | body: Expr::Block { |
| 37 | block: Block { |
| 38 | stmts: [], |
| 39 | }, |
| 40 | }, |
| 41 | } |
| 42 | "### ); |
| 43 | } |
| 44 | |