diff options
Diffstat (limited to 'js/src/jit-test/tests/wasm/js-types')
-rw-r--r-- | js/src/jit-test/tests/wasm/js-types/directives.txt | 1 | ||||
-rw-r--r-- | js/src/jit-test/tests/wasm/js-types/table-js-funcs.js | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/js-types/directives.txt b/js/src/jit-test/tests/wasm/js-types/directives.txt new file mode 100644 index 0000000000..01f722ba1e --- /dev/null +++ b/js/src/jit-test/tests/wasm/js-types/directives.txt @@ -0,0 +1 @@ +|jit-test| include:wasm.js diff --git a/js/src/jit-test/tests/wasm/js-types/table-js-funcs.js b/js/src/jit-test/tests/wasm/js-types/table-js-funcs.js new file mode 100644 index 0000000000..92b6c462ef --- /dev/null +++ b/js/src/jit-test/tests/wasm/js-types/table-js-funcs.js @@ -0,0 +1,26 @@ +// |jit-test| skip-if: !('Function' in WebAssembly) + +function testfunc(n) {} + +const table = new WebAssembly.Table({element: "anyfunc", initial: 3}); +const func1 = new WebAssembly.Function({parameters: ["i32"], results: []}, testfunc); +table.set(0, func1); +const func2 = new WebAssembly.Function({parameters: ["f32"], results: []}, testfunc); +table.set(1, func2); +const func3 = new WebAssembly.Function({parameters: ["i64"], results: []}, testfunc); +table.set(2, func3); + +const first = table.get(0); +assertEq(first instanceof WebAssembly.Function, true); +assertEq(first, func1); +assertEq(first.type().parameters[0], func1.type().parameters[0]); + +const second = table.get(1); +assertEq(second instanceof WebAssembly.Function, true); +assertEq(second, func2); +assertEq(second.type().parameters[0], func2.type().parameters[0]); + +const third = table.get(2); +assertEq(third instanceof WebAssembly.Function, true); +assertEq(third, func3); +assertEq(third.type().parameters[0], func3.type().parameters[0]); |