summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Promise/withResolvers.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262/Promise/withResolvers.js')
-rw-r--r--js/src/tests/non262/Promise/withResolvers.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/non262/Promise/withResolvers.js b/js/src/tests/non262/Promise/withResolvers.js
new file mode 100644
index 0000000000..d689da767b
--- /dev/null
+++ b/js/src/tests/non262/Promise/withResolvers.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!xulRuntime.shell) -- needs drainJobQueue
+
+{
+ let {resolve, promise} = Promise.withResolvers();
+
+ let result = undefined;
+ promise.then((v) => result = v);
+ resolve(5);
+
+ drainJobQueue();
+ assertEq(result, 5);
+}
+
+{
+ let {reject, promise} = Promise.withResolvers();
+
+ let result = undefined;
+ promise.catch((v) => result = v);
+ reject("abc");
+
+ drainJobQueue();
+ assertEq(result, "abc");
+}
+
+reportCompare(true,true);