summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-05-16 17:47:41 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-05-16 17:47:41 +0200
commit3c39307c22e69e34b85ee766b14b81e4000d71f8 (patch)
treef4df072eb108689eb6c18e2dc8a9e77c93f9e829 /tests
parentd7cdfdc8d7b8e74a6be74f4f3535ef6eac976dc1 (diff)
downloadquickjs-3c39307c22e69e34b85ee766b14b81e4000d71f8.tar.gz
quickjs-3c39307c22e69e34b85ee766b14b81e4000d71f8.zip
better promise rejection tracker heuristics (#112)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_std.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_std.js b/tests/test_std.js
index c844869..bb942d6 100644
--- a/tests/test_std.js
+++ b/tests/test_std.js
@@ -294,6 +294,22 @@ function test_async_gc()
})();
}
+/* check that the promise async rejection handler is not invoked when
+ the rejection is handled not too late after the promise
+ rejection. */
+function test_async_promise_rejection()
+{
+ var counter = 0;
+ var p1, p2, p3;
+ p1 = Promise.reject();
+ p2 = Promise.reject();
+ p3 = Promise.resolve();
+ p1.catch(() => counter++);
+ p2.catch(() => counter++);
+ p3.then(() => counter++)
+ os.setTimeout(() => { assert(counter, 3) }, 10);
+}
+
test_printf();
test_file1();
test_file2();
@@ -304,4 +320,5 @@ test_os_exec();
test_timer();
test_ext_json();
test_async_gc();
+test_async_promise_rejection();