summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Set/prototype/entries
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-array.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-map.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-object.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-set-prototype.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js29
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/entries.js23
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/length.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/name.js19
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator-empty.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/returns-iterator.js58
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-boolean.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-null.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-number.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-string.js27
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-symbol.js28
-rw-r--r--js/src/tests/test262/built-ins/Set/prototype/entries/this-not-object-throw-undefined.js27
19 files changed, 487 insertions, 0 deletions
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
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/browser.js
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
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Set/prototype/entries/shell.js
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);