aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / syn / tests / test_shebang.rs
| 1 | #![allow( |
| 2 | clippy::elidable_lifetime_names, |
| 3 | clippy::needless_lifetimes, |
| 4 | clippy::uninlined_format_args |
| 5 | )] |
| 6 | |
| 7 | #[macro_use] |
| 8 | mod snapshot; |
| 9 | |
| 10 | mod debug; |
| 11 | |
| 12 | #[test] |
| 13 | fn test_basic() { |
| 14 | let content = "#!/usr/bin/env rustx\nfn main() {}"; |
| 15 | let file = syn::parse_file(content).unwrap(); |
| 16 | snapshot!(file, @r##" |
| 17 | File { |
| 18 | shebang: Some("#!/usr/bin/env rustx"), |
| 19 | items: [ |
| 20 | Item::Fn { |
| 21 | vis: Visibility::Inherited, |
| 22 | modifiers: FnModifiers, |
| 23 | sig: Signature { |
| 24 | safety: Safety::Default, |
| 25 | ident: "main", |
| 26 | generics: Generics, |
| 27 | output: ReturnType::Default, |
| 28 | }, |
| 29 | block: Block { |
| 30 | stmts: [], |
| 31 | }, |
| 32 | }, |
| 33 | ], |
| 34 | } |
| 35 | "##); |
| 36 | } |
| 37 | |
| 38 | #[test] |
| 39 | fn test_comment() { |
| 40 | let content = "#!//am/i/a/comment\n[allow(dead_code)] fn main() {}"; |
| 41 | let file = syn::parse_file(content).unwrap(); |
| 42 | snapshot!(file, @r#" |
| 43 | File { |
| 44 | attrs: [ |
| 45 | Attribute { |
| 46 | style: AttrStyle::Inner, |
| 47 | meta: Meta::List { |
| 48 | path: Path { |
| 49 | segments: [ |
| 50 | PathSegment { |
| 51 | ident: "allow", |
| 52 | }, |
| 53 | ], |
| 54 | }, |
| 55 | delimiter: MacroDelimiter::Paren, |
| 56 | tokens: TokenStream(`dead_code`), |
| 57 | }, |
| 58 | }, |
| 59 | ], |
| 60 | items: [ |
| 61 | Item::Fn { |
| 62 | vis: Visibility::Inherited, |
| 63 | modifiers: FnModifiers, |
| 64 | sig: Signature { |
| 65 | safety: Safety::Default, |
| 66 | ident: "main", |
| 67 | generics: Generics, |
| 68 | output: ReturnType::Default, |
| 69 | }, |
| 70 | block: Block { |
| 71 | stmts: [], |
| 72 | }, |
| 73 | }, |
| 74 | ], |
| 75 | } |
| 76 | "#); |
| 77 | } |