summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/wasm/jsapi/function/call.tentative.any.js
blob: 2e63d5fa103fd1736200622525602a07287caa98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js

function addxy(x, y) {
    return x + y
}

test(() => {
    var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
    assert_equals(fun(1, 2), 3)
}, "test calling function")

test(() => {
    var fun = new WebAssembly.Function({parameters: ["i32", "i32"], results: ["i32"]}, addxy);
    assert_throws_js(TypeError, () => new fun(1, 2));
}, "test constructing function");