Skip to content

Commit e250852

Browse files
authored
Pass ignore attribute to unsupported tests (#4360)
1 parent a4bc41b commit e250852

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
* Fixed passing large arrays into Rust failing because of internal memory allocations invalidating the memory buffer.
4444
[#4353](https://github.com/rustwasm/wasm-bindgen/pull/4353)
4545

46+
* Pass along an `ignore` attribute to `unsupported` tests.
47+
[#4360](https://github.com/rustwasm/wasm-bindgen/pull/4360)
48+
4649
--------------------------------------------------------------------------------
4750

4851
## [0.2.99](https://github.com/rustwasm/wasm-bindgen/compare/0.2.98...0.2.99)

crates/test-macro/src/lib.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn wasm_bindgen_test(
8080
None => quote! { ::core::option::Option::None },
8181
};
8282

83-
let ignore = match ignore {
83+
let ignore_par = match &ignore {
8484
Some(Some(lit)) => {
8585
quote! { ::core::option::Option::Some(::core::option::Option::Some(#lit)) }
8686
}
@@ -89,9 +89,9 @@ pub fn wasm_bindgen_test(
8989
};
9090

9191
let test_body = if attributes.r#async {
92-
quote! { cx.execute_async(test_name, #ident, #should_panic_par, #ignore); }
92+
quote! { cx.execute_async(test_name, #ident, #should_panic_par, #ignore_par); }
9393
} else {
94-
quote! { cx.execute_sync(test_name, #ident, #should_panic_par, #ignore); }
94+
quote! { cx.execute_sync(test_name, #ident, #should_panic_par, #ignore_par); }
9595
};
9696

9797
// We generate a `#[no_mangle]` with a known prefix so the test harness can
@@ -130,6 +130,18 @@ pub fn wasm_bindgen_test(
130130
quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #should_panic)] }
131131
)
132132
}
133+
134+
if let Some(ignore) = ignore {
135+
let ignore = if let Some(lit) = ignore {
136+
quote! { ignore = #lit }
137+
} else {
138+
quote! { ignore }
139+
};
140+
141+
tokens.extend(
142+
quote! { #[cfg_attr(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))), #ignore)] }
143+
)
144+
}
133145
}
134146

135147
tokens.extend(leading_tokens);

0 commit comments

Comments
 (0)