diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb6a1baad5..43521462c0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,9 @@ * Fixed bindings and comments for `Atomics.wait`. [#3509](https://github.com/rustwasm/wasm-bindgen/pull/3509) +* Fixed `wasm_bindgen_test` macro to handle raw identifiers in test names. + [#3541](https://github.com/rustwasm/wasm-bindgen/pull/3541) + ## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87) Released 2023-06-12. diff --git a/crates/test-macro/src/lib.rs b/crates/test-macro/src/lib.rs index d67055c63a4..fbde05846d9 100644 --- a/crates/test-macro/src/lib.rs +++ b/crates/test-macro/src/lib.rs @@ -4,6 +4,7 @@ extern crate proc_macro; use proc_macro2::*; +use quote::format_ident; use quote::quote; use quote::quote_spanned; use std::sync::atomic::*; @@ -89,8 +90,7 @@ pub fn wasm_bindgen_test( // We generate a `#[no_mangle]` with a known prefix so the test harness can // later slurp up all of these functions and pass them as arguments to the // main test harness. This is the entry point for all tests. - let name = format!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); - let name = Ident::new(&name, Span::call_site()); + let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst)); tokens.extend( (quote! { #[no_mangle]