summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/StringIteratorPrototype/next
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/length.js34
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/name.js31
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration-surrogate-pairs.js86
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration.js38
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-missing-internal-slots.js24
-rw-r--r--js/src/tests/test262/built-ins/StringIteratorPrototype/next/shell.js0
7 files changed, 213 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/StringIteratorPrototype/next/browser.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/browser.js
diff --git a/js/src/tests/test262/built-ins/StringIteratorPrototype/next/length.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/length.js
new file mode 100644
index 0000000000..6facc1101b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/length.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 21.1.5.2.1
+description: >
+ %StringIteratorPrototype%.next.length is 0.
+info: |
+ %StringIteratorPrototype%.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]
+features: [Symbol.iterator]
+---*/
+
+var StringIteratorProto = Object.getPrototypeOf(new String()[Symbol.iterator]());
+
+assert.sameValue(StringIteratorProto.next.length, 0);
+
+verifyNotEnumerable(StringIteratorProto.next, "length");
+verifyNotWritable(StringIteratorProto.next, "length");
+verifyConfigurable(StringIteratorProto.next, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/StringIteratorPrototype/next/name.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/name.js
new file mode 100644
index 0000000000..f990a85d2f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/name.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 21.1.5.2.1
+description: >
+ %StringIteratorPrototype%.next.name is "next".
+info: |
+ %StringIteratorPrototype%.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]
+features: [Symbol.iterator]
+---*/
+
+var StringIteratorProto = Object.getPrototypeOf(new String()[Symbol.iterator]());
+
+assert.sameValue(StringIteratorProto.next.name, "next");
+
+verifyNotEnumerable(StringIteratorProto.next, "name");
+verifyNotWritable(StringIteratorProto.next, "name");
+verifyConfigurable(StringIteratorProto.next, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration-surrogate-pairs.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration-surrogate-pairs.js
new file mode 100644
index 0000000000..07cd36feca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration-surrogate-pairs.js
@@ -0,0 +1,86 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.5.2.1
+description: >
+ Iteration should respect UTF-16-encoded Unicode code points specified via
+ surrogate pairs.
+features: [Symbol.iterator]
+---*/
+
+var lo = '\uD834';
+var hi = '\uDF06';
+var pair = lo + hi;
+var string = 'a' + pair + 'b' + lo + pair + hi + lo;
+var iterator = string[Symbol.iterator]();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value, 'a', 'First normal code point `value`');
+assert.sameValue(result.done, false, 'First normal code point `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value, pair, 'Surrogate pair `value` (between normal code points)'
+);
+assert.sameValue(
+ result.done, false, 'Surrogate pair `done` flag (between normal code points)'
+);
+
+result = iterator.next();
+assert.sameValue(result.value, 'b', 'Second normal code point `value`');
+assert.sameValue(result.done, false, 'Second normal code point `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value,
+ lo,
+ 'Lone lower code point `value` (following normal code point)'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Lone lower code point `done` flag (following normal code point)'
+);
+
+result = iterator.next();
+assert.sameValue(
+ result.value,
+ pair,
+ 'Surrogate pair `value` (between lone lower- and upper- code points)'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Surrogate pair `done` flag (between lone lower- and upper- code points)'
+);
+
+result = iterator.next();
+assert.sameValue(result.value, hi, 'Lone upper code point `value`');
+assert.sameValue(result.done, false, 'Lone upper code point `done` flag');
+
+result = iterator.next();
+assert.sameValue(
+ result.value,
+ lo,
+ 'Lone lower code point `value` (following lone upper code point)'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Lone lower code point `done` flag (following lone upper code point)'
+);
+
+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/StringIteratorPrototype/next/next-iteration.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration.js
new file mode 100644
index 0000000000..9b04368887
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-iteration.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.5.2.1
+description: >
+ Iteration should visit each UTF-8 code point exactly once.
+features: [Symbol.iterator]
+---*/
+
+var string = "abc";
+var iterator = string[Symbol.iterator]();
+var result;
+
+result = iterator.next();
+assert.sameValue(result.value, 'a', 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, 'b', 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iterator.next();
+assert.sameValue(result.value, 'c', '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/StringIteratorPrototype/next/next-missing-internal-slots.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-missing-internal-slots.js
new file mode 100644
index 0000000000..888cde7aa2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/next-missing-internal-slots.js
@@ -0,0 +1,24 @@
+// 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-properties-of-string-iterator-instances
+description: >
+ If the `this` value does not have all of the internal slots of an String
+ Iterator Instance (21.1.5.3), throw a `TypeError` exception.
+info: |
+ ...
+ If O does not have all of the internal slots of a String Iterator Instance (21.1.5.3),
+ throw a TypeError exception.
+ ...
+
+features: [Symbol.iterator]
+---*/
+
+var iterator = ''[Symbol.iterator]();
+var object = Object.create(iterator);
+
+assert.throws(TypeError, function() {
+ object.next();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/StringIteratorPrototype/next/shell.js b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/StringIteratorPrototype/next/shell.js