wasm-bindgen/crates/webidl-tests/throws.rs
Alex Crichton 7e16690f10
Migrate webidl tests to wasm_bindgen_test (#590)
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!
2018-07-30 11:06:29 -07:00

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());
}