Skip to content

Commit

Permalink
Handle raw identifiers in wasm_bindgen_test macro (#3541)
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
  • Loading branch information
snOm3ad committed Aug 5, 2023
1 parent 903a256 commit f0d1009
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -42,6 +42,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.
Expand Down
4 changes: 2 additions & 2 deletions crates/test-macro/src/lib.rs
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit f0d1009

Please sign in to comment.