summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/any/reject-immed.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/Promise/any/reject-immed.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Promise/any/reject-immed.js')
-rw-r--r--js/src/tests/test262/built-ins/Promise/any/reject-immed.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Promise/any/reject-immed.js b/js/src/tests/test262/built-ins/Promise/any/reject-immed.js
new file mode 100644
index 0000000000..33d445e1de
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Promise/any/reject-immed.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-promise.any
+description: Rejecting through immediate invocation of the provided resolving function
+info: |
+ ...
+ Let promiseCapability be NewPromiseCapability(C).
+ ...
+ Let result be PerformPromiseAny(iteratorRecord, promiseCapability, C).
+ ...
+
+ Runtime Semantics: PerformPromiseAny
+ ...
+ 8. Repeat
+ ...
+ r. Perform ? Invoke(nextPromise, "then",
+ « resultCapability.[[Resolve]], rejectElement »).
+
+
+ Promise.any Reject Element Functions
+ ...
+ 6. Return RejectPromise(promise, reason).
+flags: [async]
+features: [Promise.any, arrow-function]
+---*/
+
+let callCount = 0;
+let thenable = {
+ then(_, reject) {
+ callCount++;
+ reject('reason');
+ }
+};
+
+Promise.any([thenable])
+ .then(() => {
+ $DONE('The promise should not be fulfilled.');
+ }, (error) => {
+ assert.sameValue(callCount, 1, "callCount === 1");
+ assert(error instanceof AggregateError, "error instanceof AggregateError");
+ assert.sameValue(error.errors[0], "reason", "error.errors[0] === 'reason'");
+ $DONE();
+ });