diff --git a/tests/node/glob-exp-host-mod-multiple/index.wat b/tests/node/glob-exp-host-mod-multiple/index.wat new file mode 100644 index 00000000..41f763ea --- /dev/null +++ b/tests/node/glob-exp-host-mod-multiple/index.wat @@ -0,0 +1,14 @@ +(module + (import "env" "changeGlobal" (func $changeGlobal (param i32))) + (func $main (export "main") + i32.const 2 + global.set 0 + i32.const 5 + call $changeGlobal + ) + (func $foo (export "foo") + global.get 0 + drop + ) + (global (export "global") (mut i32) i32.const 1) +) diff --git a/tests/node/glob-exp-host-mod-multiple/test.js b/tests/node/glob-exp-host-mod-multiple/test.js new file mode 100644 index 00000000..9c9c7f22 --- /dev/null +++ b/tests/node/glob-exp-host-mod-multiple/test.js @@ -0,0 +1,16 @@ +export default async function test(wasmBinary) { + let instance + let imports = { + env: { + changeGlobal: (value) => { + instance.exports.global.value = 1 + instance.exports.foo() + instance.exports.global.value = 2 + instance.exports.foo() + } + } + } + let wasm = await WebAssembly.instantiate(wasmBinary, imports) + instance = wasm.instance + instance.exports.main() +} \ No newline at end of file