-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathprototypes.any.js
43 lines (37 loc) · 1.71 KB
/
prototypes.any.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// META: global=window,dedicatedworker,jsshell
// META: script=/wasm/jsapi/assertions.js
// META: script=/wasm/jsapi/wasm-module-builder.js
let emptyModuleBinary;
setup(() => {
emptyModuleBinary = new WasmModuleBuilder().toBuffer();
});
test(() => {
class _Module extends WebAssembly.Module {}
let module = new _Module(emptyModuleBinary);
assert_true(module instanceof _Module, "_Module instanceof _Module");
assert_true(module instanceof WebAssembly.Module, "_Module instanceof WebAssembly.Module");
}, "_Module");
test(() => {
class _Instance extends WebAssembly.Instance {}
let instance = new _Instance(new WebAssembly.Module(emptyModuleBinary));
assert_true(instance instanceof _Instance, "_Instance instanceof _Instance");
assert_true(instance instanceof WebAssembly.Instance, "_Instance instanceof WebAssembly.Instance");
}, "_Instance");
test(() => {
class _Memory extends WebAssembly.Memory {}
let memory = new _Memory({initial: 0, maximum: 1});
assert_true(memory instanceof _Memory, "_Memory instanceof _Memory");
assert_true(memory instanceof WebAssembly.Memory, "_Memory instanceof WebAssembly.Memory");
}, "_Memory");
test(() => {
class _Table extends WebAssembly.Table {}
let table = new _Table({initial: 0, element: "anyfunc"});
assert_true(table instanceof _Table, "_Table instanceof _Table");
assert_true(table instanceof WebAssembly.Table, "_Table instanceof WebAssembly.Table");
}, "_Table");
test(() => {
class _Global extends WebAssembly.Global {}
let global = new _Global({value: "i32", mutable: false}, 0);
assert_true(global instanceof _Global, "_Global instanceof _Global");
assert_true(global instanceof WebAssembly.Global, "_Global instanceof WebAssembly.Global");
}, "_Global");