mirror of https://github.com/tc39/test262.git
Promise.p.finally: test SpeciesConstructor and Symbol.species lookup
This commit is contained in:
parent
f8456c6dac
commit
a392f6ced8
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2017 V8. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
author: Sathya Gunasekaran
|
||||
description: finally calls the SpeciesConstructor
|
||||
esid: sec-promise.prototype.finally
|
||||
features: [Promise.prototype.finally]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
||||
var count = 0;
|
||||
class FooPromise extends Promise {
|
||||
constructor(resolve, reject) {
|
||||
count++;
|
||||
return super(resolve, reject);
|
||||
}
|
||||
}
|
||||
|
||||
new FooPromise(r => r())
|
||||
.finally(() => {})
|
||||
.then(() => {
|
||||
assert.sameValue(count, 6, "6 new promises were created");
|
||||
$DONE();
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2017 V8. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
author: Sathya Gunasekaran
|
||||
description: finally calls the SpeciesConstructor
|
||||
esid: sec-promise.prototype.finally
|
||||
features: [Promise.prototype.finally]
|
||||
---*/
|
||||
|
||||
|
||||
class MyPromise extends Promise {
|
||||
static get [Symbol.species]() { return Promise; }
|
||||
}
|
||||
|
||||
var p = Promise
|
||||
.resolve()
|
||||
.finally(() => MyPromise.resolve());
|
||||
|
||||
assert.sameValue(true, p instanceof Promise);
|
||||
assert.sameValue(false, p instanceof MyPromise);
|
Loading…
Reference in New Issue