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