blob: 8289b3d1cb84485118ec52d7a7eca54337b5102d [file] [log] [blame]
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09001extern crate syn;
2
David Tolnayc3f98562018-11-02 08:55:05 -07003mod features;
4
David Tolnay7d8b3312019-03-10 01:26:11 -08005#[macro_use]
6mod macros;
7
8use syn::{Expr, Item};
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +09009
10#[test]
11fn test_async_fn() {
David Tolnayfcd53cf2019-05-09 13:06:59 -070012 let input = "async fn process() {}";
13
14 snapshot!(input as Item, @r###"
15 Item::Fn {
16 vis: Inherited,
17 asyncness: Some,
18 ident: "process",
19 decl: FnDecl {
20 generics: Generics,
21 output: Default,
22 },
23 block: Block,
24 ⋮}
25 "###);
Yusuke Sasakif00a3ef2018-07-20 22:08:42 +090026}
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +090027
28#[test]
29fn test_async_closure() {
David Tolnayfcd53cf2019-05-09 13:06:59 -070030 let input = "async || {}";
31
32 snapshot!(input as Expr, @r###"
33 Expr::Closure {
34 asyncness: Some,
35 output: Default,
36 body: Expr::Block {
37 block: Block,
38 },
39 ⋮}
40 "###);
Yusuke Sasaki4e5d9662018-07-21 02:49:47 +090041}