From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../built-ins/SetIteratorPrototype/next/browser.js | 0 ...does-not-have-mapiterator-internal-slots-set.js | 41 +++++++++++++++++ .../does-not-have-mapiterator-internal-slots.js | 44 ++++++++++++++++++ .../SetIteratorPrototype/next/iteration-mutable.js | 48 ++++++++++++++++++++ .../SetIteratorPrototype/next/iteration.js | 44 ++++++++++++++++++ .../built-ins/SetIteratorPrototype/next/length.js | 33 ++++++++++++++ .../built-ins/SetIteratorPrototype/next/name.js | 30 ++++++++++++ .../built-ins/SetIteratorPrototype/next/shell.js | 0 .../next/this-not-object-throw-entries.js | 50 ++++++++++++++++++++ .../next/this-not-object-throw-keys.js | 53 ++++++++++++++++++++++ .../this-not-object-throw-prototype-iterator.js | 53 ++++++++++++++++++++++ .../next/this-not-object-throw-values.js | 53 ++++++++++++++++++++++ 12 files changed, 449 insertions(+) create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/browser.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots-set.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration-mutable.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/length.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/name.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/shell.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-entries.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-keys.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-prototype-iterator.js create mode 100644 js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-values.js (limited to 'js/src/tests/test262/built-ins/SetIteratorPrototype/next') diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/browser.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots-set.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots-set.js new file mode 100644 index 0000000000..1889a087d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots-set.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.5.2.1 +description: > + Throws a TypeError if `this` does not have all of the internal slots of a Set + Iterator Instance. +info: | + %SetIteratorPrototype%.next ( ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have all of the internal slots of a Set Iterator Instance + (23.2.5.3), throw a TypeError exception. + ... +features: [Symbol.iterator] +---*/ + +var set = new Set([1, 2]); + +var iterator = set[Symbol.iterator](); +assert.throws(TypeError, function() { + iterator.next.call(set); +}); + +iterator = set.entries(); +assert.throws(TypeError, function() { + iterator.next.call(set); +}); + +iterator = set.keys(); +assert.throws(TypeError, function() { + iterator.next.call(set); +}); + +iterator = set.values(); +assert.throws(TypeError, function() { + iterator.next.call(set); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js new file mode 100644 index 0000000000..f44a421160 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js @@ -0,0 +1,44 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.5.2.1 +description: > + Throws a TypeError if `this` does not have all of the internal slots of a Set + Iterator Instance. +info: | + %SetIteratorPrototype%.next ( ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have all of the internal slots of a Set Iterator Instance + (23.2.5.3), throw a TypeError exception. + ... +features: [Symbol.iterator] +---*/ + +var set = new Set([1, 2]); + +var iterator = set[Symbol.iterator](); +assert.throws(TypeError, function() { + iterator.next.call({}); +}); + +iterator = set.entries(); +assert.throws(TypeError, function() { + iterator.next.call({}); +}); + +iterator = set.keys(); +assert.throws(TypeError, function() { + iterator.next.call({}); +}); + +iterator = set.values(); +assert.throws(TypeError, function() { + iterator.next.call({}); +}); + +// does not throw an Error +iterator.next.call(set[Symbol.iterator]()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration-mutable.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration-mutable.js new file mode 100644 index 0000000000..5f08a84c1d --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration-mutable.js @@ -0,0 +1,48 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype-@@iterator +description: > + When an item is added to the set after the iterator is created but before + the iterator is "done" (as defined by 23.2.5.2.1), the new item should be + accessible via iteration. When an item is added to the set after the + iterator is "done", the new item should not be accessible via iteration. +features: [Symbol.iterator] +---*/ + +var set = new Set(); +set.add(1); +set.add(2); + +var iterator = set[Symbol.iterator](); +var result; + +result = iterator.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +set.add(3); + +result = iterator.next(); +assert.sameValue(result.value, 2, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value, 3, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value, undefined, 'Exhausted result `value`'); +assert.sameValue(result.done, true, 'Exhausted result `done` flag'); + +set.add(4); + +result = iterator.next(); +assert.sameValue( + result.value, undefined, 'Exhausted result `value` (repeated request)' +); +assert.sameValue( + result.done, true, 'Exhausted result `done` flag (repeated request)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration.js new file mode 100644 index 0000000000..18db7e2108 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration.js @@ -0,0 +1,44 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype-@@iterator +description: > + The method should return a valid iterator with the context as the + IteratedObject. +features: + - Symbol.iterator +---*/ + +var set = new Set(); +set.add(1); +set.add(2); +set.add(3); + +var iterator = set[Symbol.iterator](); +var result; + +result = iterator.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value, 2, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value, 3, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value, undefined, 'Exhausted result `value`'); +assert.sameValue(result.done, true, 'Exhausted result `done` flag'); + +result = iterator.next(); +assert.sameValue( + result.value, undefined, 'Exhausted result `value` (repeated request)' +); +assert.sameValue( + result.done, true, 'Exhausted result `done` flag (repeated request)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/length.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/length.js new file mode 100644 index 0000000000..8d1afa8e61 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/length.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 23.2.5.2.1 +description: > + %SetIteratorPrototype%.next.length is 0. +info: | + %SetIteratorPrototype%.next ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +var SetIteratorProto = Object.getPrototypeOf(new Set().values()); + +assert.sameValue(SetIteratorProto.next.length, 0); + +verifyNotEnumerable(SetIteratorProto.next, "length"); +verifyNotWritable(SetIteratorProto.next, "length"); +verifyConfigurable(SetIteratorProto.next, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/name.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/name.js new file mode 100644 index 0000000000..1792ccd461 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/name.js @@ -0,0 +1,30 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 23.2.5.2.1 +description: > + %SetIteratorPrototype%.next.name is "next". +info: | + %SetIteratorPrototype%.next ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +var SetIteratorProto = Object.getPrototypeOf(new Set().values()); + +assert.sameValue(SetIteratorProto.next.name, "next"); + +verifyNotEnumerable(SetIteratorProto.next, "name"); +verifyNotWritable(SetIteratorProto.next, "name"); +verifyConfigurable(SetIteratorProto.next, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/shell.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-entries.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-entries.js new file mode 100644 index 0000000000..8e8b1f3444 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-entries.js @@ -0,0 +1,50 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.5.2.1 +description: > + Throws a TypeError if `this` value is not an Object. +info: | + From Set.prototype.entries() + + %SetIteratorPrototype%.next ( ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +features: + - Symbol + - Symbol.iterator +---*/ + +var set = new Set([1, 2]); +var iterator = set.entries(); + +assert.throws(TypeError, function() { + iterator.next.call(false); +}); + +assert.throws(TypeError, function() { + iterator.next.call(1); +}); + +assert.throws(TypeError, function() { + iterator.next.call(''); +}); + +assert.throws(TypeError, function() { + iterator.next.call(undefined); +}); + +assert.throws(TypeError, function() { + iterator.next.call(null); +}); + +assert.throws(TypeError, function() { + iterator.next.call(Symbol()); +}); + +// does not throw an Error +iterator.next.call(set[Symbol.iterator]()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-keys.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-keys.js new file mode 100644 index 0000000000..8e4b5cfe44 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-keys.js @@ -0,0 +1,53 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.5.2.1 +description: > + Throws a TypeError if `this` value is not an Object. +info: | + From Set.prototype.keys() + + %SetIteratorPrototype%.next ( ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +features: + - Symbol + - Symbol.iterator +---*/ + +var set = new Set([ + [1, 11], + [2, 22] +]); +var iterator = set.keys(); + +assert.throws(TypeError, function() { + iterator.next.call(false); +}); + +assert.throws(TypeError, function() { + iterator.next.call(1); +}); + +assert.throws(TypeError, function() { + iterator.next.call(''); +}); + +assert.throws(TypeError, function() { + iterator.next.call(undefined); +}); + +assert.throws(TypeError, function() { + iterator.next.call(null); +}); + +assert.throws(TypeError, function() { + iterator.next.call(Symbol()); +}); + +// does not throw an Error +iterator.next.call(set[Symbol.iterator]()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-prototype-iterator.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-prototype-iterator.js new file mode 100644 index 0000000000..8f25bcf8a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-prototype-iterator.js @@ -0,0 +1,53 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.5.2.1 +description: > + Throws a TypeError if `this` value is not an Object. +info: | + Using Set.prototype[Symbol.iterator]() + + %SetIteratorPrototype%.next ( ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +features: + - Symbol + - Symbol.iterator +---*/ + +var set = new Set([ + [1, 11], + [2, 22] +]); +var iterator = set[Symbol.iterator](); + +assert.throws(TypeError, function() { + iterator.next.call(false); +}); + +assert.throws(TypeError, function() { + iterator.next.call(1); +}); + +assert.throws(TypeError, function() { + iterator.next.call(''); +}); + +assert.throws(TypeError, function() { + iterator.next.call(undefined); +}); + +assert.throws(TypeError, function() { + iterator.next.call(null); +}); + +assert.throws(TypeError, function() { + iterator.next.call(Symbol()); +}); + +// does not throw an Error +iterator.next.call(set[Symbol.iterator]()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-values.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-values.js new file mode 100644 index 0000000000..4734dd3e64 --- /dev/null +++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-values.js @@ -0,0 +1,53 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.5.2.1 +description: > + Throws a TypeError if `this` value is not an Object. +info: | + From Set.prototype.values() + + %SetIteratorPrototype%.next ( ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +features: + - Symbol + - Symbol.iterator +---*/ + +var set = new Set([ + [1, 11], + [2, 22] +]); +var iterator = set.values(); + +assert.throws(TypeError, function() { + iterator.next.call(false); +}); + +assert.throws(TypeError, function() { + iterator.next.call(1); +}); + +assert.throws(TypeError, function() { + iterator.next.call(''); +}); + +assert.throws(TypeError, function() { + iterator.next.call(undefined); +}); + +assert.throws(TypeError, function() { + iterator.next.call(null); +}); + +assert.throws(TypeError, function() { + iterator.next.call(Symbol()); +}); + +// does not throw an Error +iterator.next.call(set[Symbol.iterator]()); + +reportCompare(0, 0); -- cgit v1.2.3