-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support #[should_panic]
in tests
#2286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Oh, well, do we have no unwinding support in WASM at all? #[test]
fn foo() {
use std::panic::catch_unwind;
let _ = catch_unwind(|| {
panic!("test");
});
} Even that panics. |
Unfortunately this is not possible to easily support today because wasm does not have catchable exceptions, this will work once that proposal stabilizes, though! |
I just tripped across this but had noticed earlier that the test runner now trampolines through JS to run the individual tests, which if I'm not mistaken gives it an interface to observe and handle the error. Is it feasible to implement this feature on that basis now or is there another blocker? |
wasm_bindgen does not yet support #[should_panic] see also rustwasm/wasm-bindgen#2286
* assert there are no circular references the check is costly in release builds and should always fail note that the current PartialEq impl is *not* symmetric! should be fixed as well, with an improved design * remove internal test for cyclic node refs wasm_bindgen does not yet support #[should_panic] see also rustwasm/wasm-bindgen#2286
* assert there are no circular references the check is costly in release builds and should always fail note that the current PartialEq impl is *not* symmetric! should be fixed as well, with an improved design * remove internal test for cyclic node refs wasm_bindgen does not yet support #[should_panic] see also rustwasm/wasm-bindgen#2286
* assert there are no circular references the check is costly in release builds and should always fail note that the current PartialEq impl is *not* symmetric! should be fixed as well, with an improved design * remove internal test for cyclic node refs wasm_bindgen does not yet support #[should_panic] see also rustwasm/wasm-bindgen#2286
I think it would be great to have support for the
#[should_panic]
attribute on tests. That is, the following works as expected when compiling natively:But if I am doing the same in WASM:
I see
warning: unused attribute
and a panic:The text was updated successfully, but these errors were encountered: