fix broken Iterator.prototype constructor/Symbol.toStringTag tests (#3996)

* fix broken Iterator.prototype constructor/Symbol.toStringTag tests

* fix lint: unused includes
This commit is contained in:
Michael Ficarra 2024-01-24 18:37:28 -07:00 committed by GitHub
parent fed13c1915
commit e4f91b6381
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 18 deletions

View File

@ -6,13 +6,11 @@ description: Property descriptor
info: |
`Iterator.prototype[@@toStringTag]` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }
features: [iterator-helpers]
includes: [propertyHelper.js]
---*/
verifyConfigurable(Iterator.prototype, Symbol.toStringTag);
verifyNotEnumerable(Iterator.prototype, Symbol.toStringTag);
let desc = Object.getOwnPropertyDescriptor(Iterator.prototype, Symbol.toStringTag);
assert.sameValue(typeof desc.get, 'function');
assert.sameValue(typeof desc.set, 'function');
assert.sameValue(desc.configurable, true);
assert.sameValue(desc.enumerable, false);
assert.sameValue(desc.value, undefined);
assert.sameValue(desc.writable, undefined);

View File

@ -24,15 +24,15 @@ assert.sameValue(get.call(), 'Iterator');
// 1. If _this_ is not an Object, then
// 1. Throw a *TypeError* exception.
assert.throws(() => set.call(undefined, ''));
assert.throws(() => set.call(null, ''));
assert.throws(() => set.call(true, ''));
assert.throws(TypeError, () => set.call(undefined, ''));
assert.throws(TypeError, () => set.call(null, ''));
assert.throws(TypeError, () => set.call(true, ''));
// 1. If _this_ is _home_, then
// 1. NOTE: Throwing here emulates assignment to a non-writable data property on the _home_ object in strict mode code.
// 1. Throw a *TypeError* exception.
assert.throws(() => set.call(IteratorPrototype, ''));
assert.throws(() => IteratorPrototype[Symbol.toStringTag] = '');
assert.throws(TypeError, () => set.call(IteratorPrototype, ''));
assert.throws(TypeError, () => IteratorPrototype[Symbol.toStringTag] = '');
assert.sameValue(Iterator.prototype[Symbol.toStringTag], 'Iterator');
assert.sameValue(get.call(), 'Iterator');

View File

@ -6,13 +6,11 @@ description: Property descriptor
info: |
`Iterator.prototype.constructor` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }
features: [iterator-helpers]
includes: [propertyHelper.js]
---*/
verifyConfigurable(Iterator.prototype, 'constructor');
verifyNotEnumerable(Iterator.prototype, 'constructor');
let desc = Object.getOwnPropertyDescriptor(Iterator.prototype, 'constructor');
assert.sameValue(typeof desc.get, 'function');
assert.sameValue(typeof desc.set, 'function');
assert.sameValue(desc.configurable, true);
assert.sameValue(desc.enumerable, false);
assert.sameValue(desc.value, undefined);
assert.sameValue(desc.writable, undefined);

View File

@ -24,15 +24,15 @@ assert.sameValue(get.call(), Iterator);
// 1. If _this_ is not an Object, then
// 1. Throw a *TypeError* exception.
assert.throws(() => set.call(undefined, ''));
assert.throws(() => set.call(null, ''));
assert.throws(() => set.call(true, ''));
assert.throws(TypeError, () => set.call(undefined, ''));
assert.throws(TypeError, () => set.call(null, ''));
assert.throws(TypeError, () => set.call(true, ''));
// 1. If _this_ is _home_, then
// 1. NOTE: Throwing here emulates assignment to a non-writable data property on the _home_ object in strict mode code.
// 1. Throw a *TypeError* exception.
assert.throws(() => set.call(IteratorPrototype, ''));
assert.throws(() => IteratorPrototype.constructor = '');
assert.throws(TypeError, () => set.call(IteratorPrototype, ''));
assert.throws(TypeError, () => IteratorPrototype.constructor = '');
assert.sameValue(Iterator.prototype.constructor, Iterator);
assert.sameValue(get.call(), Iterator);