interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / syn / tests / test_token_trees.rs

38 lines · 762 bytes Raw Blame History
1#![allow(
2 clippy::elidable_lifetime_names,
3 clippy::needless_lifetimes,
4 clippy::uninlined_format_args
5)]
6
7#[macro_use]
8mod snapshot;
9
10mod debug;
11
12use proc_macro2::TokenStream;
13use quote::quote;
14use syn::Lit;
15
16#[test]
17fn 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]
34fn 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}