mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-15 17:50:51 +00:00
Fix name collisions with test functions and intrinsics (#2123)
There was an unfortunate collision with how test symbols were named and the various bindings functions exported by wasm-bindgen. This commit fixes these issues by using a separate prefix for `#[wasm_bindgen_test]` than other `#[wasm_bindgen]` functions which should avoid the name clash. Closes #2121
This commit is contained in:
parent
d896446edc
commit
dc54c0fb25
@ -63,7 +63,7 @@ fn main() -> anyhow::Result<()> {
|
||||
let mut tests = Vec::new();
|
||||
|
||||
for export in wasm.exports.iter() {
|
||||
if !export.name.starts_with("__wbg_test") {
|
||||
if !export.name.starts_with("__wbgt_") {
|
||||
continue;
|
||||
}
|
||||
tests.push(export.name.to_string());
|
||||
|
@ -59,11 +59,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!(
|
||||
"__wbg_test_{}_{}",
|
||||
ident,
|
||||
CNT.fetch_add(1, Ordering::SeqCst)
|
||||
);
|
||||
let name = format!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst));
|
||||
let name = Ident::new(&name, Span::call_site());
|
||||
tokens.extend(
|
||||
(quote! {
|
||||
|
Loading…
x
Reference in New Issue
Block a user