summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/SetIteratorPrototype
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/Symbol.toStringTag.js31
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots-set.js41
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/does-not-have-mapiterator-internal-slots.js44
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration-mutable.js48
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/iteration.js44
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/length.js33
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/name.js30
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-entries.js50
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-keys.js53
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-prototype-iterator.js53
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/next/this-not-object-throw-values.js53
-rw-r--r--js/src/tests/test262/built-ins/SetIteratorPrototype/shell.js0
15 files changed, 480 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..3fb24f16c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/Symbol.toStringTag.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2014 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.2
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "Set Iterator".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features:
+ - Symbol.toStringTag
+ - Symbol.iterator
+---*/
+
+var SetIteratorProto = Object.getPrototypeOf(new Set()[Symbol.iterator]());
+
+assert.sameValue(
+ 'Set Iterator',
+ SetIteratorProto[Symbol.toStringTag],
+ '`Set Iterator` is `SetIteratorProto[Symbol.toStringTag]`'
+);
+
+verifyNotEnumerable(SetIteratorProto, Symbol.toStringTag);
+verifyNotWritable(SetIteratorProto, Symbol.toStringTag);
+verifyConfigurable(SetIteratorProto, Symbol.toStringTag);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/browser.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/browser.js
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
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/browser.js
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
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/next/shell.js
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);
diff --git a/js/src/tests/test262/built-ins/SetIteratorPrototype/shell.js b/js/src/tests/test262/built-ins/SetIteratorPrototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SetIteratorPrototype/shell.js