2014-10-23 19:58:31 +02:00
|
|
|
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
|
|
|
// See LICENSE for details.
|
|
|
|
|
|
|
|
/*---
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2015-12-30 20:15:30 +01:00
|
|
|
[...]
|
|
|
|
5. Let rejectResult be Call(promiseCapability.[[Reject]], undefined, «r»).
|
|
|
|
[...]
|
|
|
|
|
|
|
|
25.4.1.3.1 Promise Reject Functions
|
|
|
|
[...]
|
|
|
|
6. Return RejectPromise(promise, reason).
|
|
|
|
es6id: 25.4.4.4
|
2014-10-23 19:58:31 +02:00
|
|
|
author: Sam Mikes
|
|
|
|
description: Promise.reject creates a new settled promise
|
2016-02-12 18:59:51 +01:00
|
|
|
flags: [async]
|
2014-10-23 19:58:31 +02:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var p = Promise.reject(3);
|
|
|
|
|
|
|
|
if (!(p instanceof Promise)) {
|
2018-02-15 21:11:21 +01:00
|
|
|
$ERROR("Expected Promise.reject to return a promise.");
|
2014-10-23 19:58:31 +02:00
|
|
|
}
|
|
|
|
|
2018-02-15 21:11:21 +01:00
|
|
|
p.then(function() {
|
|
|
|
$ERROR("Promise should not be fulfilled.");
|
|
|
|
}, function(arg) {
|
|
|
|
if (arg !== 3) {
|
|
|
|
$ERROR("Expected promise to be rejected with supplied arg, got " + arg);
|
|
|
|
}
|
2014-10-23 19:58:31 +02:00
|
|
|
}).then($DONE, $DONE);
|