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/Set/prototype/entries/browser.js | 0 .../does-not-have-setdata-internal-slot-array.js | 29 +++++++++++ .../does-not-have-setdata-internal-slot-map.js | 28 +++++++++++ .../does-not-have-setdata-internal-slot-object.js | 28 +++++++++++ ...not-have-setdata-internal-slot-set-prototype.js | 28 +++++++++++ .../does-not-have-setdata-internal-slot-weakset.js | 29 +++++++++++ .../built-ins/Set/prototype/entries/entries.js | 23 +++++++++ .../built-ins/Set/prototype/entries/length.js | 19 +++++++ .../built-ins/Set/prototype/entries/name.js | 19 +++++++ .../Set/prototype/entries/not-a-constructor.js | 35 +++++++++++++ .../prototype/entries/returns-iterator-empty.js | 27 ++++++++++ .../Set/prototype/entries/returns-iterator.js | 58 ++++++++++++++++++++++ .../built-ins/Set/prototype/entries/shell.js | 0 .../entries/this-not-object-throw-boolean.js | 28 +++++++++++ .../entries/this-not-object-throw-null.js | 27 ++++++++++ .../entries/this-not-object-throw-number.js | 27 ++++++++++ .../entries/this-not-object-throw-string.js | 27 ++++++++++ .../entries/this-not-object-throw-symbol.js | 28 +++++++++++ .../entries/this-not-object-throw-undefined.js | 27 ++++++++++ 19 files changed, 487 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/browser.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/entries.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/length.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/name.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/shell.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js create mode 100644 js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js (limited to 'js/src/tests/test262/built-ins/Set/prototype/entries') diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/browser.js b/js/src/tests/test262/built-ins/Set/prototype/entries/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js new file mode 100644 index 0000000000..771d461f65 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception. + ... + +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call([]); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js new file mode 100644 index 0000000000..5326a8eb6b --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(new Map()); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(new Map()); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js new file mode 100644 index 0000000000..37e0b7f7a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call({}); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js new file mode 100644 index 0000000000..588d45aee6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(Set.prototype); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(Set.prototype); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js new file mode 100644 index 0000000000..b8b7c97974 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 2. If S does not have a [[SetData]] internal slot, throw a TypeError exception. + ... +features: [WeakSet] +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(new WeakSet()); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(new WeakSet()); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/entries.js b/js/src/tests/test262/built-ins/Set/prototype/entries/entries.js new file mode 100644 index 0000000000..2dc649d63a --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/entries.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue( + typeof Set.prototype.entries, + "function", + "`typeof Set.prototype.entries` is `'function'`" +); + +verifyNotEnumerable(Set.prototype, "entries"); +verifyWritable(Set.prototype, "entries"); +verifyConfigurable(Set.prototype, "entries"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/length.js b/js/src/tests/test262/built-ins/Set/prototype/entries/length.js new file mode 100644 index 0000000000..5f7ab9dd4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/length.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Set.prototype.entries.length, 0, "The value of `Set.prototype.entries.length` is `0`"); + +verifyNotEnumerable(Set.prototype.entries, "length"); +verifyNotWritable(Set.prototype.entries, "length"); +verifyConfigurable(Set.prototype.entries, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/name.js b/js/src/tests/test262/built-ins/Set/prototype/entries/name.js new file mode 100644 index 0000000000..ffcfec6df1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/name.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Set.prototype.entries.name, "entries", "The value of `Set.prototype.entries.name` is `'entries'`"); + +verifyNotEnumerable(Set.prototype.entries, "name"); +verifyNotWritable(Set.prototype.entries, "name"); +verifyConfigurable(Set.prototype.entries, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js b/js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js new file mode 100644 index 0000000000..cd385a7077 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Set.prototype.entries does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, Set, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Set.prototype.entries), + false, + 'isConstructor(Set.prototype.entries) must return false' +); + +assert.throws(TypeError, () => { + let s = new Set([]); new s.entries(); +}, '`let s = new Set([]); new s.entries()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js new file mode 100644 index 0000000000..306b48546f --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 7. Return iterator. + + +---*/ + +var set = new Set(); +var iterator = set.entries(); +var result = iterator.next(); + +assert.sameValue(result.value, undefined, "The value of `result.value` is `undefined`"); +assert.sameValue(result.done, true, "The value of `result.done` is `true`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js new file mode 100644 index 0000000000..8193ffd31f --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js @@ -0,0 +1,58 @@ +// 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.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + ... + 7. Return iterator. + + +---*/ + +var set = new Set(); +set.add(1); +set.add(2); +set.add(3); + +var iterator = set.entries(); +var result; + +result = iterator.next(); +assert.sameValue(result.value[0], 1, 'First result `value` ("key")'); +assert.sameValue(result.value[1], 1, 'First result `value` ("value")'); +assert.sameValue(result.value.length, 2, 'First result `value` (length)'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value[0], 2, 'Second result `value` ("key")'); +assert.sameValue(result.value[1], 2, 'Second result `value` ("value")'); +assert.sameValue(result.value.length, 2, 'Second result `value` (length)'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iterator.next(); +assert.sameValue(result.value[0], 3, 'Third result `value` ("key")'); +assert.sameValue(result.value[1], 3, 'Third result `value` ("value")'); +assert.sameValue(result.value.length, 2, 'Third result `value` (length)'); +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/Set/prototype/entries/shell.js b/js/src/tests/test262/built-ins/Set/prototype/entries/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js new file mode 100644 index 0000000000..d3ebbfdc38 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + 1. If Type(set) is not Object, throw a TypeError exception. + ... + +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(false); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(false); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js new file mode 100644 index 0000000000..93613ac76d --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + 1. If Type(set) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(null); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js new file mode 100644 index 0000000000..6d03bbba3e --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + 1. If Type(set) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(0); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(0); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js new file mode 100644 index 0000000000..8230c391d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + 1. If Type(set) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(""); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(""); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js new file mode 100644 index 0000000000..cddd8e20f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + 1. If Type(set) is not Object, throw a TypeError exception. + ... +features: [Symbol] +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(Symbol()); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(Symbol()); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js new file mode 100644 index 0000000000..cbae89d89d --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-set.prototype.entries +description: > + Set.prototype.entries ( ) + + ... + 2. Return CreateSetIterator(S, "key+value"). + + + 23.2.5.1 CreateSetIterator Abstract Operation + + 1. If Type(set) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + Set.prototype.entries.call(undefined); +}); + +assert.throws(TypeError, function() { + var s = new Set(); + s.entries.call(undefined); +}); + +reportCompare(0, 0); -- cgit v1.2.3