mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-26 17:31:44 +00:00
76b407eb79
Signed-off-by: 徐未来 <xuweilai2@huawei.com>
44 lines
806 B
Rust
44 lines
806 B
Rust
#![allow(clippy::uninlined_format_args)]
|
|
|
|
#[macro_use]
|
|
mod macros;
|
|
|
|
use syn::{Expr, Item};
|
|
|
|
#[test]
|
|
fn test_async_fn() {
|
|
let input = "async fn process() {}";
|
|
|
|
snapshot!(input as Item, @r###"
|
|
Item::Fn {
|
|
vis: Visibility::Inherited,
|
|
sig: Signature {
|
|
asyncness: Some,
|
|
ident: "process",
|
|
generics: Generics,
|
|
output: ReturnType::Default,
|
|
},
|
|
block: Block {
|
|
stmts: [],
|
|
},
|
|
}
|
|
"###);
|
|
}
|
|
|
|
#[test]
|
|
fn test_async_closure() {
|
|
let input = "async || {}";
|
|
|
|
snapshot!(input as Expr, @r###"
|
|
Expr::Closure {
|
|
asyncness: Some,
|
|
output: ReturnType::Default,
|
|
body: Expr::Block {
|
|
block: Block {
|
|
stmts: [],
|
|
},
|
|
},
|
|
}
|
|
"###);
|
|
}
|