Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/resolve/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 "resolve" capability
5 esid: sec-promise.resolve
6 es6id: 25.4.4.5
7 info: |
8 1. Let C be the this value.
9 [...]
10 4. Let promiseCapability be ? NewPromiseCapability(C).
11 5. Perform ? Call(promiseCapability.[[Resolve]], undefined, « x »).
12
13 25.4.1.5 NewPromiseCapability
14 [...]
15 6. Let promise be Construct(C, «executor»).
16 7. ReturnIfAbrupt(promise).
17 ---*/
18
19 var P = function(executor) {
20 return new Promise(function() {
21 executor(
22 function() {
23 throw new Test262Error();
24 },
25 function() {}
26 );
27 });
28 };
29
30 assert.throws(Test262Error, function() {
31 Promise.resolve.call(P);
32 });