• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(clippy::uninlined_format_args)]
2 
3 #[macro_use]
4 mod macros;
5 
6 #[test]
test_basic()7 fn 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             },
23         ],
24     }
25     "###);
26 }
27 
28 #[test]
test_comment()29 fn test_comment() {
30     let content = "#!//am/i/a/comment\n[allow(dead_code)] fn main() {}";
31     let file = syn::parse_file(content).unwrap();
32     snapshot!(file, @r###"
33     File {
34         attrs: [
35             Attribute {
36                 style: AttrStyle::Inner,
37                 meta: Meta::List {
38                     path: Path {
39                         segments: [
40                             PathSegment {
41                                 ident: "allow",
42                             },
43                         ],
44                     },
45                     delimiter: MacroDelimiter::Paren,
46                     tokens: TokenStream(`dead_code`),
47                 },
48             },
49         ],
50         items: [
51             Item::Fn {
52                 vis: Visibility::Inherited,
53                 sig: Signature {
54                     ident: "main",
55                     generics: Generics,
56                     output: ReturnType::Default,
57                 },
58                 block: Block,
59             },
60         ],
61     }
62     "###);
63 }
64