1#![allow(clippy::uninlined_format_args)] 2 3#[macro_use] 4mod macros; 5 6#[test] 7fn test_basic() { 8 let content = "#!/usr/bin/env rustx\nfn main() {}"; 9 let file = syn::parse_file(content).unwrap(); 10 snapshot!(file, @r###" 11 File { 12 shebang: Some("#!/usr/bin/env rustx"), 13 items: [ 14 Item::Fn { 15 vis: Visibility::Inherited, 16 sig: Signature { 17 ident: "main", 18 generics: Generics, 19 output: ReturnType::Default, 20 }, 21 block: Block { 22 stmts: [], 23 }, 24 }, 25 ], 26 } 27 "###); 28} 29 30#[test] 31fn test_comment() { 32 let content = "#!//am/i/a/comment\n[allow(dead_code)] fn main() {}"; 33 let file = syn::parse_file(content).unwrap(); 34 snapshot!(file, @r###" 35 File { 36 attrs: [ 37 Attribute { 38 style: AttrStyle::Inner, 39 meta: Meta::List { 40 path: Path { 41 segments: [ 42 PathSegment { 43 ident: "allow", 44 }, 45 ], 46 }, 47 delimiter: MacroDelimiter::Paren, 48 tokens: TokenStream(`dead_code`), 49 }, 50 }, 51 ], 52 items: [ 53 Item::Fn { 54 vis: Visibility::Inherited, 55 sig: Signature { 56 ident: "main", 57 generics: Generics, 58 output: ReturnType::Default, 59 }, 60 block: Block { 61 stmts: [], 62 }, 63 }, 64 ], 65 } 66 "###); 67} 68