Debian Codegraph @

js/src/tests/test262/built-ins/Promise/reject/capability-invocation-error.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: Abrupt completion returned by "reject" capability
5 esid: sec-promise.reject
6 info: |
7 1. Let C be the this value.
8 [...]
9 3. Let promiseCapability be ? NewPromiseCapability(C).
10 4. Perform ? Call(promiseCapability.[[Reject]], undefined, « r »).
11
12 25.4.1.5 NewPromiseCapability
13 [...]
14 6. Let promise be Construct(C, «executor»).
15 7. ReturnIfAbrupt(promise).
16 ---*/
17
18 var P = function(executor) {
19 return new Promise(function() {
20 executor(
21 function() {},
22 function() {
23 throw new Test262Error();
24 }
25 );
26 });
27 };
28
29 assert.throws(Test262Error, function() {
30 Promise.reject.call(P);
31 });
32
33 reportCompare(0, 0);