Promise.any: cleanup in @@species tests

This commit is contained in:
Rick Waldron 2020-03-25 09:39:19 -04:00
parent d9265df3ab
commit 5c68b60ad3
2 changed files with 10 additions and 7 deletions

View File

@ -4,7 +4,7 @@
/*---
esid: sec-promise.any
description: >
Promise.any() does not retrieve `Symbol.species` property of the "`this` value"
Promise.any.call(Custom, ...) does not derive a constructor via SpeciesConstructor()
info: |
1. Let C be the this value.
2. Let promiseCapability be ? NewPromiseCapability(C).
@ -20,13 +20,13 @@ flags: [async]
features: [Promise.any, Symbol.species, class, class-static-method, computed-property-names, Symbol, arrow-function]
---*/
class C extends Promise {
class Custom extends Promise {
static get [Symbol.species]() {
throw new Test262Error('Getter for Symbol.species called');
throw new Test262Error('Erroneous Get(C, @@species) via SpeciesConstructor() occurred.');
}
static resolve() {
throw new Test262Error('C.resolve was reached');
throw new Test262Error('Custom.resolve was reached');
}
}
Promise.any.call(C, [1]).then(() => $DONE(), $DONE);
Promise.any.call(Custom, [1]).then(() => $DONE(), $DONE);

View File

@ -4,7 +4,7 @@
/*---
esid: sec-promise.any
description: >
Promise.any() does not retrieve `Symbol.species` property of the "`this` value".
Promise.any() does not derive a constructor via SpeciesConstructor()
info: |
1. Let C be the this value.
2. Let promiseCapability be ? NewPromiseCapability(C).
@ -22,7 +22,10 @@ features: [Promise.any, Symbol.species, Symbol, arrow-function]
Object.defineProperty(Promise, Symbol.species, {
get() {
throw new Test262Error('Getter for Symbol.species called');
throw new Test262Error('Erroneous Get(C, @@species) via SpeciesConstructor() occurred.');
}
static resolve() {
throw new Test262Error('Promise.resolve was reached');
}
});