summaryrefslogtreecommitdiff
path: root/std/wasi/snapshot_preview1_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/wasi/snapshot_preview1_test.ts')
-rw-r--r--std/wasi/snapshot_preview1_test.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/std/wasi/snapshot_preview1_test.ts b/std/wasi/snapshot_preview1_test.ts
index 44877117c..d7e29e195 100644
--- a/std/wasi/snapshot_preview1_test.ts
+++ b/std/wasi/snapshot_preview1_test.ts
@@ -180,3 +180,45 @@ Deno.test("context_start", function () {
"export _start must be a function",
);
});
+
+Deno.test("context_initialize", function () {
+ assertThrows(
+ () => {
+ const context = new Context({});
+ context.initialize({
+ exports: {
+ _initialize() {},
+ },
+ });
+ },
+ TypeError,
+ "must provide a memory export",
+ );
+
+ assertThrows(
+ () => {
+ const context = new Context({});
+ context.initialize({
+ exports: {
+ _start() {},
+ memory: new WebAssembly.Memory({ initial: 1 }),
+ },
+ });
+ },
+ TypeError,
+ "export _start must not be a function",
+ );
+
+ assertThrows(
+ () => {
+ const context = new Context({});
+ context.initialize({
+ exports: {
+ memory: new WebAssembly.Memory({ initial: 1 }),
+ },
+ });
+ },
+ TypeError,
+ "export _initialize must be a function",
+ );
+});