summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js
blob: afc8a7241f54e3566683fdb362e091408cb67d00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const fs = require('fs');
const process = require('process');
const assert = require('assert');
const buffer = fs.readFileSync(process.argv[2]);

let m = new WebAssembly.Module(buffer);
let list = WebAssembly.Module.exports(m);
console.log('exports', list);

let bad = false;
for (let i = 0; i < list.length; i++) {
  const e = list[i];
  if (e.name == "foo" || e.kind != "function")
    continue;

  console.log('unexpected exported symbol:', e.name);
  bad = true;
}

if (bad)
  process.exit(1);