mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-20 00:27:26 +03:00
7e16690f10
This commit moves the `webidl/tests` folder to a new `crates/webidl-tests` crate (to have a test-only build script) and ports them to the `#[wasm_bindgen_test]` attribute, which should hopefully make testing much speedier for execution!
28 lines
742 B
Rust
28 lines
742 B
Rust
use wasm_bindgen_test::*;
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/throws.rs"));
|
|
|
|
#[wasm_bindgen_test]
|
|
fn throws() {
|
|
assert!(Thang::new(0).is_err());
|
|
let thang = Thang::new(1).unwrap();
|
|
|
|
assert!(thang.ok_attr().is_ok());
|
|
assert!(thang.set_ok_attr(0).is_ok());
|
|
|
|
assert!(thang.err_attr().is_err());
|
|
assert!(thang.set_err_attr(0).is_err());
|
|
|
|
assert!(thang.ok_method().is_ok());
|
|
assert!(thang.err_method().is_err());
|
|
|
|
assert!(Thang::ok_static_method().is_ok());
|
|
assert!(Thang::err_static_method().is_err());
|
|
|
|
assert!(Thang::ok_static_attr().is_ok());
|
|
assert!(Thang::set_ok_static_attr(0).is_ok());
|
|
|
|
assert!(Thang::err_static_attr().is_err());
|
|
assert!(Thang::set_err_static_attr(0).is_err());
|
|
}
|