MCPcopy Create free account
hub / github.com/nodejs/node / assert_function

Function assert_function

test/fixtures/wpt/wasm/jsapi/function/type.tentative.any.js:10–20  ·  view source on GitHub ↗
(functype, func)

Source from the content-addressed store, hash-verified

8function doNothing() {}
9
10function assert_function(functype, func) {
11 var wasmFunc = new WebAssembly.Function(functype, func);
12 assert_equals(functype.parameters.length, wasmFunc.type().parameters.length);
13 for(let i = 0; i < functype.parameters.length; i++) {
14 assert_equals(functype.parameters[i], wasmFunc.type().parameters[i]);
15 }
16 assert_equals(functype.results.length, wasmFunc.type().results.length);
17 for(let i = 0; i < functype.results.length; i++) {
18 assert_equals(functype.results[i], wasmFunc.type().results[i]);
19 }
20}
21
22test(() => {
23 assert_function({results: [], parameters: []}, doNothing);

Callers 1

Calls 2

assert_equalsFunction · 0.50
typeMethod · 0.45

Tested by

no test coverage detected