mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Fix $DONE usage
This commit is contained in:
parent
c5b1c97362
commit
57d5ffa471
@ -15,13 +15,14 @@ flags: [async]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
Promise.resolve(1).then(function() {
|
Promise.resolve(1).then(function() {
|
||||||
return Promise.resolve(2);
|
return Promise.resolve();
|
||||||
});
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
Promise.prototype.then = function(_resolve, reject) {
|
var then = Promise.prototype.then;
|
||||||
|
Promise.prototype.then = function(resolve, reject) {
|
||||||
assert(!isConstructor(reject));
|
assert(!isConstructor(reject));
|
||||||
assert.sameValue(reject.length, 1);
|
assert.sameValue(reject.length, 1);
|
||||||
assert.sameValue(reject.name, '');
|
assert.sameValue(reject.name, '');
|
||||||
|
|
||||||
$DONE();
|
return then.call(this, resolve, reject);
|
||||||
};
|
};
|
||||||
|
@ -15,13 +15,14 @@ flags: [async]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
Promise.resolve(1).then(function() {
|
Promise.resolve(1).then(function() {
|
||||||
return Promise.resolve(2);
|
return Promise.resolve();
|
||||||
});
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
Promise.prototype.then = function(resolve) {
|
var then = Promise.prototype.then;
|
||||||
|
Promise.prototype.then = function(resolve, reject) {
|
||||||
assert(!isConstructor(resolve));
|
assert(!isConstructor(resolve));
|
||||||
assert.sameValue(resolve.length, 1);
|
assert.sameValue(resolve.length, 1);
|
||||||
assert.sameValue(resolve.name, '');
|
assert.sameValue(resolve.name, '');
|
||||||
|
|
||||||
$DONE();
|
return then.call(this, resolve, reject);
|
||||||
};
|
};
|
||||||
|
@ -17,12 +17,16 @@ includes: [isConstructor.js]
|
|||||||
flags: [async]
|
flags: [async]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
Promise.reject(new Test262Error()).finally(function() {});
|
Promise.reject(new Test262Error())
|
||||||
|
.finally(function() {})
|
||||||
|
.then($DONE, $DONE);
|
||||||
|
|
||||||
|
var then = Promise.prototype.then;
|
||||||
Promise.prototype.then = function(thrower) {
|
Promise.prototype.then = function(thrower) {
|
||||||
assert(!isConstructor(thrower));
|
assert(!isConstructor(thrower));
|
||||||
assert.sameValue(thrower.length, 1);
|
assert.sameValue(thrower.length, 1);
|
||||||
assert.sameValue(thrower.name, '');
|
assert.sameValue(thrower.name, '');
|
||||||
assert.throws(Test262Error, thrower);
|
assert.throws(Test262Error, thrower);
|
||||||
|
|
||||||
$DONE();
|
return then.call(this, thrower);
|
||||||
};
|
};
|
||||||
|
@ -19,12 +19,16 @@ flags: [async]
|
|||||||
|
|
||||||
var value = {};
|
var value = {};
|
||||||
|
|
||||||
Promise.resolve(value).finally(function() {});
|
Promise.resolve(value)
|
||||||
|
.finally(function() {})
|
||||||
|
.then($DONE, $DONE);
|
||||||
|
|
||||||
|
var then = Promise.prototype.then;
|
||||||
Promise.prototype.then = function(valueThunk) {
|
Promise.prototype.then = function(valueThunk) {
|
||||||
assert(!isConstructor(valueThunk));
|
assert(!isConstructor(valueThunk));
|
||||||
assert.sameValue(valueThunk.length, 1);
|
assert.sameValue(valueThunk.length, 1);
|
||||||
assert.sameValue(valueThunk.name, '');
|
assert.sameValue(valueThunk.name, '');
|
||||||
assert.sameValue(valueThunk(), value);
|
assert.sameValue(valueThunk(), value);
|
||||||
|
|
||||||
$DONE();
|
return then.call(this, valueThunk);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user