Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/proc-macro2/tests/test_fmt.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / proc-macro2 / tests / test_fmt.rs` 26 lines ยท 1263 bytes Raw Blame History 1 use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree}; 2 use std::iter; 3 4 #[test] 5 fn test_fmt_group() { 6 let ident = Ident::new("x", Span::call_site()); 7 let inner = TokenStream::from_iter(iter::once(TokenTree::Ident(ident))); 8 let parens_empty = Group::new(Delimiter::Parenthesis, TokenStream::new()); 9 let parens_nonempty = Group::new(Delimiter::Parenthesis, inner.clone()); 10 let brackets_empty = Group::new(Delimiter::Bracket, TokenStream::new()); 11 let brackets_nonempty = Group::new(Delimiter::Bracket, inner.clone()); 12 let braces_empty = Group::new(Delimiter::Brace, TokenStream::new()); 13 let braces_nonempty = Group::new(Delimiter::Brace, inner.clone()); 14 let none_empty = Group::new(Delimiter::None, TokenStream::new()); 15 let none_nonempty = Group::new(Delimiter::None, inner); 16 17 // Matches libproc_macro. 18 assert_eq!("()", parens_empty.to_string()); 19 assert_eq!("(x)", parens_nonempty.to_string()); 20 assert_eq!("[]", brackets_empty.to_string()); 21 assert_eq!("[x]", brackets_nonempty.to_string()); 22 assert_eq!("{ }", braces_empty.to_string()); 23 assert_eq!("{ x }", braces_nonempty.to_string()); 24 assert_eq!("", none_empty.to_string()); 25 assert_eq!("x", none_nonempty.to_string()); 26 }