Skip to content

Commit

Permalink
add glob-exp-host-mod-multiple test
Browse files Browse the repository at this point in the history
  • Loading branch information
doehyunbaek committed Dec 19, 2023
1 parent cb5427a commit 45e1ac9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/node/glob-exp-host-mod-multiple/index.wat
Original file line number Diff line number Diff line change
@@ -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)
)
16 changes: 16 additions & 0 deletions tests/node/glob-exp-host-mod-multiple/test.js
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 45e1ac9

Please sign in to comment.