2
0

test_asyncness.rs 650 B

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