summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2018-10-12 11:22:52 -0700
committerRyan Dahl <ry@tinyclouds.org>2018-10-12 14:22:52 -0400
commit45d3b8955de628db0ef051eeb8e351837b4a3b3e (patch)
tree252bab755760d86cab48502abdabe6ff0c2b9af2 /tests
parentc9f95d51da9f6075b1f28a842dc830ec5fe7a30e (diff)
Fix promise reject issue (#936)
Diffstat (limited to 'tests')
-rw-r--r--tests/018_async_catch.ts14
-rw-r--r--tests/018_async_catch.ts.out3
-rw-r--r--tests/async_error.ts.out1
3 files changed, 18 insertions, 0 deletions
diff --git a/tests/018_async_catch.ts b/tests/018_async_catch.ts
new file mode 100644
index 000000000..b073654d9
--- /dev/null
+++ b/tests/018_async_catch.ts
@@ -0,0 +1,14 @@
+async function fn() {
+ throw new Error("message");
+}
+async function call() {
+ try {
+ console.log("before await fn()");
+ await fn();
+ console.log("after await fn()");
+ } catch (error) {
+ console.log("catch");
+ }
+ console.log("after try-catch");
+}
+call().catch(() => console.log("outer catch"));
diff --git a/tests/018_async_catch.ts.out b/tests/018_async_catch.ts.out
new file mode 100644
index 000000000..4fc219973
--- /dev/null
+++ b/tests/018_async_catch.ts.out
@@ -0,0 +1,3 @@
+before await fn()
+catch
+after try-catch
diff --git a/tests/async_error.ts.out b/tests/async_error.ts.out
index 862cf0f96..69be815a0 100644
--- a/tests/async_error.ts.out
+++ b/tests/async_error.ts.out
@@ -1,5 +1,6 @@
hello
before error
+world
Error: error
at foo ([WILDCARD]tests/async_error.ts:4:9)
at eval ([WILDCARD]tests/async_error.ts:7:1)