Debian Codegraph @

js/src/jit-test/tests/wasm/name.js

raw
1 // An export name may contain a null terminator
2 let exports = wasmEvalText(`(module
3 (func)
4 (export "\\00first" (func 0))
5 (export "\\00second" (func 0))
6 )`).exports;
7 assertEq(exports["\0first"] instanceof Function, true);
8 assertEq(exports["\0second"] instanceof Function, true);
9
10 // An import name may contain a null terminator
11 let imports = {
12 "\0module": {
13 "\0field": 10,
14 }
15 };
16 let {global} = wasmEvalText(`(module
17 (import "\\00module" "\\00field" (global i32))
18 (export "global" (global 0))
19 )`, imports).exports;
20 assertEq(global.value, 10);