summaryrefslogtreecommitdiff
path: root/std/wasi/snapshot_preview1_test.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-01-06 18:29:55 +0800
committerGitHub <noreply@github.com>2021-01-06 05:29:55 -0500
commitf4b03a8887ded3d75811e0bce3c39da3788365bb (patch)
tree0c5e747e585a088f40d49cf1b776caed50a3a3b0 /std/wasi/snapshot_preview1_test.ts
parent54240c22af6233d1d977d469868b0d9050cad6da (diff)
BREAKING(std/wasi): return exit code from start (#9022)
This returns the exit code directly from the start entry point instead of throwing it and letting the user handle it. As a result the exit status is an implementation detail and has been made internal.
Diffstat (limited to 'std/wasi/snapshot_preview1_test.ts')
-rw-r--r--std/wasi/snapshot_preview1_test.ts24
1 files changed, 18 insertions, 6 deletions
diff --git a/std/wasi/snapshot_preview1_test.ts b/std/wasi/snapshot_preview1_test.ts
index 1fe94a4cc..073c30aab 100644
--- a/std/wasi/snapshot_preview1_test.ts
+++ b/std/wasi/snapshot_preview1_test.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import Context, { ExitStatus } from "./snapshot_preview1.ts";
+import Context from "./snapshot_preview1.ts";
import { assert, assertEquals, assertThrows } from "../testing/asserts.ts";
import { copy } from "../fs/mod.ts";
import * as path from "../path/mod.ts";
@@ -181,11 +181,25 @@ Deno.test("context_start", function () {
"export _start must be a function",
);
- try {
+ {
const context = new Context({
exitOnReturn: false,
});
- context.start({
+ const exitCode = context.start({
+ exports: {
+ _start() {
+ },
+ memory: new WebAssembly.Memory({ initial: 1 }),
+ },
+ });
+ assertEquals(exitCode, null);
+ }
+
+ {
+ const context = new Context({
+ exitOnReturn: false,
+ });
+ const exitCode = context.start({
exports: {
_start() {
const exit = context.exports["proc_exit"] as CallableFunction;
@@ -194,9 +208,7 @@ Deno.test("context_start", function () {
memory: new WebAssembly.Memory({ initial: 1 }),
},
});
- } catch (err) {
- assert(err instanceof ExitStatus);
- assertEquals(err.code, 0);
+ assertEquals(exitCode, 0);
}
assertThrows(