summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs6
-rw-r--r--cli/tests/wasm_unreachable.js50
-rw-r--r--cli/tests/wasm_unreachable.out3
3 files changed, 59 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 5ecd6d35b..9bdc1db60 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -1872,6 +1872,12 @@ itest!(wasm_async {
output: "wasm_async.out",
});
+itest!(wasm_unreachable {
+ args: "run wasm_unreachable.js",
+ output: "wasm_unreachable.out",
+ exit_code: 1,
+});
+
itest!(top_level_await {
args: "run --allow-read top_level_await.js",
output: "top_level_await.out",
diff --git a/cli/tests/wasm_unreachable.js b/cli/tests/wasm_unreachable.js
new file mode 100644
index 000000000..991ebcec8
--- /dev/null
+++ b/cli/tests/wasm_unreachable.js
@@ -0,0 +1,50 @@
+// WebAssembly module containing a single function with an unreachable instruction
+const binary = Uint8Array.from([
+ 0x00,
+ 0x61,
+ 0x73,
+ 0x6d,
+ 0x01,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+ 0x04,
+ 0x01,
+ 0x60,
+ 0x00,
+ 0x00,
+ 0x03,
+ 0x02,
+ 0x01,
+ 0x00,
+ 0x07,
+ 0x0f,
+ 0x01,
+ 0x0b,
+ 0x75,
+ 0x6e,
+ 0x72,
+ 0x65,
+ 0x61,
+ 0x63,
+ 0x68,
+ 0x61,
+ 0x62,
+ 0x6c,
+ 0x65,
+ 0x00,
+ 0x00,
+ 0x0a,
+ 0x05,
+ 0x01,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x0b,
+]);
+
+const module = new WebAssembly.Module(binary);
+const instance = new WebAssembly.Instance(module);
+
+instance.exports.unreachable();
diff --git a/cli/tests/wasm_unreachable.out b/cli/tests/wasm_unreachable.out
new file mode 100644
index 000000000..64978bbb8
--- /dev/null
+++ b/cli/tests/wasm_unreachable.out
@@ -0,0 +1,3 @@
+error: Uncaught RuntimeError: unreachable
+ at unreachable (<anonymous>:0:40)
+ at [WILDCARD]/deno/cli/tests/wasm_unreachable.js:[WILDCARD]:18