Debian Codegraph @

.cargo/vendor/syn/tests/test_asyncness.rs

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