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