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-2.0.119 / tests / test_token_trees.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 | use proc_macro2::TokenStream; |
| 13 | use quote::quote; |
| 14 | use syn::Lit; |
| 15 | |
| 16 | #[test] |
| 17 | fn test_struct() { |
| 18 | let input = " |
| 19 | #[derive(Debug, Clone)] |
| 20 | pub struct Item { |
| 21 | pub ident: Ident, |
| 22 | pub attrs: Vec<Attribute>, |
| 23 | } |
| 24 | "; |
| 25 | |
| 26 | snapshot!(input as TokenStream, @r##" |
| 27 | TokenStream( |
| 28 | `# [derive (Debug , Clone)] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`, |
| 29 | ) |
| 30 | "##); |
| 31 | } |
| 32 | |
| 33 | #[test] |
| 34 | fn test_literal_mangling() { |
| 35 | let code = "0_4"; |
| 36 | let parsed: Lit = syn::parse_str(code).unwrap(); |
| 37 | assert_eq!(code, quote!(#parsed).to_string()); |
| 38 | } |