mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-24 02:23:11 +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!
27 lines
696 B
JavaScript
27 lines
696 B
JavaScript
global.Thang = class Thang {
|
|
constructor(value) {
|
|
if (value % 2 == 0) {
|
|
throw new Error("only odd allowed");
|
|
}
|
|
this.value = value;
|
|
}
|
|
|
|
get ok_attr() { return this.value; }
|
|
set ok_attr(x) { }
|
|
|
|
get err_attr() { throw new Error("bad"); }
|
|
set err_attr(x) { throw new Error("bad"); }
|
|
|
|
ok_method() { return this.value + 1; }
|
|
err_method() { throw new Error("bad"); }
|
|
|
|
static ok_static_method() { return 1; }
|
|
static err_static_method() { throw new Error("bad"); }
|
|
|
|
static get ok_static_attr() { return 1; }
|
|
static set ok_static_attr(x) { }
|
|
|
|
static get err_static_attr() { throw new Error("bad"); }
|
|
static set err_static_attr(x) { throw new Error("bad"); }
|
|
};
|