]>
git.proxmox.com Git - rustc.git/blob - src/test/run-make/wasm-export-all-symbols/verify.js
1 const fs
= require('fs');
2 const process
= require('process');
3 const assert
= require('assert');
4 const buffer
= fs
.readFileSync(process
.argv
[2]);
6 let m
= new WebAssembly
.Module(buffer
);
7 let list
= WebAssembly
.Module
.exports(m
);
8 console
.log('exports', list
);
10 const my_exports
= {};
13 for (const entry
of list
) {
14 if (entry
.kind
== 'function'){
17 my_exports
[entry
.name
] = entry
.kind
;
20 if (my_exports
.foo
!= "function")
21 throw new Error("`foo` wasn't defined");
23 if (my_exports
.FOO
!= "global")
24 throw new Error("`FOO` wasn't defined");
26 if (my_exports
.main
=== undefined) {
28 throw new Error("should only have one function export");
31 throw new Error("should only have two function exports");