mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-27 03:55:20 +03:00
93a510ef93
This information is embedded within the algorithm for constructing interfaces and their prototypes in the section for ECMAScript glue in the WebIDL spec... This really *should* make the `wasm_bindgen_backend::ast::ImportType::extends` member from a `Vec<Ident>` into a `Vec<syn::Path>` so that we could use `js_sys::Object` in the extends field, but that is a huge pain because then the `ImportedTypes` trait needs to be changed, and all of its implementers, etc...
29 lines
762 B
Rust
29 lines
762 B
Rust
use js_sys::Object;
|
|
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());
|
|
}
|