Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/reject/S25.4.4.4_A2.1_T1.js

raw
1 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
2 // See LICENSE for details.
3
4 /*---
5 info: |
6 [...]
7 5. Let rejectResult be Call(promiseCapability.[[Reject]], undefined, «r»).
8 [...]
9
10 25.4.1.3.1 Promise Reject Functions
11 [...]
12 6. Return RejectPromise(promise, reason).
13 es6id: 25.4.4.4
14 author: Sam Mikes
15 description: Promise.reject creates a new settled promise
16 flags: [async]
17 ---*/
18
19 var p = Promise.reject(3);
20
21 if (!(p instanceof Promise)) {
22 $ERROR("Expected Promise.reject to return a promise.");
23 }
24
25 p.then(function() {
26 $ERROR("Promise should not be fulfilled.");
27 }, function(arg) {
28 if (arg !== 3) {
29 $ERROR("Expected promise to be rejected with supplied arg, got " + arg);
30 }
31 }).then($DONE, $DONE);