mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 21:11:22 +00:00
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!
This commit is contained in:
26
crates/webidl-tests/throws.js
Normal file
26
crates/webidl-tests/throws.js
Normal file
@ -0,0 +1,26 @@
|
||||
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"); }
|
||||
};
|
Reference in New Issue
Block a user