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