• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(
2     clippy::elidable_lifetime_names,
3     clippy::needless_lifetimes,
4     clippy::uninlined_format_args
5 )]
6 
7 #[macro_use]
8 mod macros;
9 
10 use proc_macro2::TokenStream;
11 use quote::quote;
12 use syn::Lit;
13 
14 #[test]
test_struct()15 fn test_struct() {
16     let input = "
17         #[derive(Debug, Clone)]
18         pub struct Item {
19             pub ident: Ident,
20             pub attrs: Vec<Attribute>,
21         }
22     ";
23 
24     snapshot!(input as TokenStream, @r##"
25     TokenStream(
26         `# [derive (Debug , Clone)] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`,
27     )
28     "##);
29 }
30 
31 #[test]
test_literal_mangling()32 fn test_literal_mangling() {
33     let code = "0_4";
34     let parsed: Lit = syn::parse_str(code).unwrap();
35     assert_eq!(code, quote!(#parsed).to_string());
36 }
37