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