diff options
Diffstat (limited to 'std/wasi/snapshot_preview1_test.ts')
-rw-r--r-- | std/wasi/snapshot_preview1_test.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/std/wasi/snapshot_preview1_test.ts b/std/wasi/snapshot_preview1_test.ts index f102f083d..55982545f 100644 --- a/std/wasi/snapshot_preview1_test.ts +++ b/std/wasi/snapshot_preview1_test.ts @@ -198,6 +198,23 @@ Deno.test("context_start", function () { assert(err instanceof ExitStatus); assertEquals(err.code, 0); } + + assertThrows( + () => { + const context = new Context({}); + context.start({ + exports: { + memory: new WebAssembly.Memory({ initial: 1 }), + _start() {}, + }, + }); + context.start({ + exports: {}, + }); + }, + Error, + "WebAssembly.Instance has already started", + ); }); Deno.test("context_initialize", function () { @@ -240,4 +257,20 @@ Deno.test("context_initialize", function () { TypeError, "export _initialize must be a function", ); + assertThrows( + () => { + const context = new Context({}); + context.initialize({ + exports: { + memory: new WebAssembly.Memory({ initial: 1 }), + _initialize() {}, + }, + }); + context.initialize({ + exports: {}, + }); + }, + Error, + "WebAssembly.Instance has already started", + ); }); |