MCPcopy
hub / github.com/tinygo-org/tinygo / runTests

Function runTests

testdata/wasmexit.js:3–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1require('../targets/wasm_exec.js');
2
3function runTests() {
4 let testCall = (name, params, expected) => {
5 let result = go._inst.exports[name].apply(null, params);
6 if (result !== expected) {
7 console.error(`${name}(...${params}): expected result ${expected}, got ${result}`);
8 }
9 }
10
11 // These are the same tests as in TestWasmExport.
12 testCall('hello', [], undefined);
13 testCall('add', [3, 5], 8);
14 testCall('add', [7, 9], 16);
15 testCall('add', [6, 1], 7);
16 testCall('reentrantCall', [2, 3], 5);
17 testCall('reentrantCall', [1, 8], 9);
18}
19
20let go = new Go();
21go.importObject.tester = {

Callers 2

wasmexit.jsFile · 0.70
TestWasmExportFunction · 0.50

Calls 1

testCallFunction · 0.70

Tested by 1

TestWasmExportFunction · 0.40