mirror of
https://github.com/tc39/test262.git
synced 2025-07-20 04:24:40 +02:00
Fix Promise.prototype.finally test
This commit is contained in:
parent
adf2cf4204
commit
ac4d02d77a
@ -17,9 +17,19 @@ includes: [isConstructor.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
Promise.reject(new Test262Error())
|
||||
class MyError extends Error {}
|
||||
|
||||
Promise.reject(new MyError())
|
||||
.finally(function() {})
|
||||
.then($DONE, () => $DONE());
|
||||
.then(function(value) {
|
||||
$DONE('Expected promise to be rejected, got fulfilled with ' + value);
|
||||
}, function(reason) {
|
||||
if (reason instanceof MyError) {
|
||||
$DONE();
|
||||
} else {
|
||||
$DONE(reason);
|
||||
}
|
||||
});
|
||||
|
||||
var calls = 0;
|
||||
var expected = [
|
||||
@ -33,7 +43,7 @@ Promise.prototype.then = function(resolve, reject) {
|
||||
assert.sameValue(resolve.length, expected[calls].length);
|
||||
assert.sameValue(resolve.name, expected[calls].name);
|
||||
if (calls === 0) {
|
||||
assert.throws(Test262Error, resolve);
|
||||
assert.throws(MyError, resolve);
|
||||
}
|
||||
|
||||
calls += 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user