Skip to main content

assert_tokens

Macro assert_tokens 

Source
macro_rules! assert_tokens {
    ($left:expr, $right:expr) => { ... };
}
Expand description

Asserts that two token streams produce identical output.

Both arguments are evaluated, formatted via DebugExt::raw(), and compared with assert_eq!. On failure, the diff shows raw-formatted token output.

Accepts any type implementing ToTokens, including Output and proc_macro2::TokenStream.

§Examples

let output = zyn::zyn!(fn hello() {});
let expected = quote::quote!(fn hello() {});
zyn::assert_tokens!(output, expected);