summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Segmenter/prototype
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Segmenter/prototype')
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/Symbol.toStringTag.js23
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/constructor/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/constructor/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/constructor/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/prop-desc.js24
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/branding.js29
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/caching.js20
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/length.js24
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/name.js23
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/order.js30
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/prop-desc.js30
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/type-without-lbs.js39
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/branding.js29
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/branding.js28
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/breakable-input.js56
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/index-throws.js48
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/iswordlike.js59
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/length.js25
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/name.js24
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/one-index.js70
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/out-of-bound-index.js56
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/prop-desc.js24
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/unbreakable-input.js60
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/word-iswordlike.js58
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/zero-index.js72
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/length.js24
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/name.js23
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/nested-next.js39
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/next-inside-next.js50
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/next-mix-with-containing.js55
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/prop-desc.js31
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js57
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js57
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-tostring.js37
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-word-iterable.js57
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/segment/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toString.js19
-rw-r--r--js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toStringTag.js26
47 files changed, 1353 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/Symbol.toStringTag.js b/js/src/tests/test262/intl402/Segmenter/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..2960428e22
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/Symbol.toStringTag.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.segmenter.prototype-@@tostringtag
+description: >
+ Property descriptor of Segmenter.prototype[@@toStringTag]
+info: |
+ The initial value of the @@toStringTag property is the string value "Intl.Segmenter".
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.Segmenter, Symbol.toStringTag]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype, Symbol.toStringTag, {
+ value: "Intl.Segmenter",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/browser.js b/js/src/tests/test262/intl402/Segmenter/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/browser.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/constructor/browser.js b/js/src/tests/test262/intl402/Segmenter/prototype/constructor/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/constructor/browser.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/constructor/prop-desc.js b/js/src/tests/test262/intl402/Segmenter/prototype/constructor/prop-desc.js
new file mode 100644
index 0000000000..566e36a669
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/constructor/prop-desc.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.constructor
+description: Checks the "constructor" property of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.constructor
+
+ The initial value of Intl.Segmenter.prototype.constructor is %Segmenter%.
+
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+
+ Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+features: [Intl.Segmenter]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype, "constructor", {
+ value: Intl.Segmenter,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/constructor/shell.js b/js/src/tests/test262/intl402/Segmenter/prototype/constructor/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/constructor/shell.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/prop-desc.js b/js/src/tests/test262/intl402/Segmenter/prototype/prop-desc.js
new file mode 100644
index 0000000000..34839605ec
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/prop-desc.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype
+description: Checks the "prototype" property of the Segmenter constructor.
+info: |
+ Intl.Segmenter.prototype
+
+ The value of Intl.Segmenter.prototype is %SegmenterPrototype%.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [Intl.Segmenter]
+---*/
+
+verifyProperty(Intl.Segmenter, "prototype", {
+ writable: false,
+ enumerable: false,
+ configurable: false,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/branding.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/branding.js
new file mode 100644
index 0000000000..756a9132d2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/branding.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Verifies the branding check for the "resolvedOptions" function of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.resolvedOptions ()
+
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedSegmenter]] internal slot, throw a TypeError exception.
+features: [Intl.Segmenter]
+---*/
+
+const resolvedOptions = Intl.Segmenter.prototype.resolvedOptions;
+
+assert.sameValue(typeof resolvedOptions, "function");
+
+assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
+assert.throws(TypeError, () => resolvedOptions.call(null), "null");
+assert.throws(TypeError, () => resolvedOptions.call(true), "true");
+assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
+assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
+assert.throws(TypeError, () => resolvedOptions.call(1), "1");
+assert.throws(TypeError, () => resolvedOptions.call({}), "plain object");
+assert.throws(TypeError, () => resolvedOptions.call(Intl.Segmenter), "Intl.Segmenter");
+assert.throws(TypeError, () => resolvedOptions.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/browser.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/browser.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/caching.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/caching.js
new file mode 100644
index 0000000000..96c76ec704
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/caching.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Verifies that the return value of Intl.Segmenter.prototype.resolvedOptions() is not cached.
+info: |
+ Intl.Segmenter.prototype.resolvedOptions ()
+
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+features: [Intl.Segmenter]
+---*/
+
+const s = new Intl.Segmenter("en-us");
+const options1 = s.resolvedOptions();
+const options2 = s.resolvedOptions();
+assert.notSameValue(options1, options2, "Should create a new object each time.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/length.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/length.js
new file mode 100644
index 0000000000..e43dea0c6d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/length.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Checks the "length" property of Intl.Segmenter.prototype.resolvedOptions().
+info: |
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+ The Segmenter constructor is a standard built-in property of the Intl object.
+ 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. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are 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: [Intl.Segmenter]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype.resolvedOptions, "length", {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/name.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/name.js
new file mode 100644
index 0000000000..041afb9d92
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/name.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Checks the "name" property of Intl.Segmenter.prototype.resolvedOptions().
+info: |
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+ 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, this value is the name that is given to the function in this specification.
+ 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: [Intl.Segmenter]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype.resolvedOptions, "name", {
+ value: "resolvedOptions",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/order.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/order.js
new file mode 100644
index 0000000000..aa254958c3
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/order.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Verifies the property order for the object returned by resolvedOptions().
+features: [Intl.Segmenter]
+---*/
+
+const options = new Intl.Segmenter([], {
+ "granularity": "word",
+}).resolvedOptions();
+
+const expected = [
+ "locale",
+ "granularity",
+];
+
+const actual = Object.getOwnPropertyNames(options);
+
+// Ensure all expected items are in actual and also allow other properties
+// implemented in new proposals.
+assert(actual.indexOf("locale") > -1, "\"locale\" is present");
+for (var i = 1; i < expected.length; i++) {
+ // Ensure the order as expected but allow additional new property in between
+ assert(actual.indexOf(expected[i-1]) < actual.indexOf(expected[i]), `"${expected[i-1]}" precedes "${expected[i]}"`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/prop-desc.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/prop-desc.js
new file mode 100644
index 0000000000..d210777575
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/prop-desc.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Checks the "resolvedOptions" property of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.resolvedOptions ()
+
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+
+ Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+features: [Intl.Segmenter]
+---*/
+
+assert.sameValue(
+ typeof Intl.Segmenter.prototype.resolvedOptions,
+ "function",
+ "typeof Intl.Segmenter.prototype.resolvedOptions is function"
+);
+
+verifyProperty(Intl.Segmenter.prototype, "resolvedOptions", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/shell.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/shell.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/type-without-lbs.js b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/type-without-lbs.js
new file mode 100644
index 0000000000..b12e734dba
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/resolvedOptions/type-without-lbs.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.resolvedOptions
+description: Checks the properties of the result of Intl.Segmenter.prototype.resolvedOptions().
+info: |
+ Intl.Segmenter.prototype.resolvedOptions ()
+
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 1, except the header row, do
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+includes: [propertyHelper.js]
+features: [Intl.Segmenter]
+---*/
+
+const rtf = new Intl.Segmenter("en-us", { "lineBreakStyle": "loose", "granularity": "word" });
+const options = rtf.resolvedOptions();
+assert.sameValue(Object.getPrototypeOf(options), Object.prototype, "Prototype");
+
+verifyProperty(options, "locale", {
+ value: "en-US",
+ writable: true,
+ enumerable: true,
+ configurable: true,
+});
+
+verifyProperty(options, "granularity", {
+ value: "word",
+ writable: true,
+ enumerable: true,
+ configurable: true,
+});
+
+verifyProperty(options, "lineBreakStyle", undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/branding.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/branding.js
new file mode 100644
index 0000000000..7bb5ab5ae5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/branding.js
@@ -0,0 +1,29 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Verifies the branding check for the "segment" function of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.segment( string )
+
+ 2. If Type(segment) is not Object or segment does not have an [[InitializedSegmenter]] internal slot, throw a TypeError exception.
+features: [Intl.Segmenter]
+---*/
+
+const segment = Intl.Segmenter.prototype.segment;
+
+assert.sameValue(typeof segment, "function");
+
+assert.throws(TypeError, () => segment.call(undefined), "undefined");
+assert.throws(TypeError, () => segment.call(null), "null");
+assert.throws(TypeError, () => segment.call(true), "true");
+assert.throws(TypeError, () => segment.call(""), "empty string");
+assert.throws(TypeError, () => segment.call(Symbol()), "symbol");
+assert.throws(TypeError, () => segment.call(1), "1");
+assert.throws(TypeError, () => segment.call({}), "plain object");
+assert.throws(TypeError, () => segment.call(Intl.Segmenter), "Intl.Segmenter");
+assert.throws(TypeError, () => segment.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/browser.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/browser.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/branding.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/branding.js
new file mode 100644
index 0000000000..d3b323ead2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/branding.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the branding check for the "segment" function of the %Segments.prototype%.containing.
+info: |
+ %Segments.prototype%.containing ( index )
+ 1. Let segments be the this value.
+ 2. Perform ? RequireInternalSlot(segments, [[SegmentsSegmenter]]).
+
+features: [Intl.Segmenter]
+---*/
+const segment = (new Intl.Segmenter()).segment("123");
+const containing = segment.containing;
+assert.sameValue(typeof containing, "function");
+assert.throws(TypeError, () => containing.call(undefined), "undefined");
+assert.throws(TypeError, () => containing.call(null), "null");
+assert.throws(TypeError, () => containing.call(true), "true");
+assert.throws(TypeError, () => containing.call(""), "empty string");
+assert.throws(TypeError, () => containing.call(Symbol()), "symbol");
+assert.throws(TypeError, () => containing.call(1), "1");
+assert.throws(TypeError, () => containing.call({}), "plain object");
+assert.throws(TypeError, () => containing.call(Intl.Segmenter), "Intl.Segmenter");
+assert.throws(TypeError, () => containing.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");
+assert.sameValue(undefined, containing.call(segment, -1));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/breakable-input.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/breakable-input.js
new file mode 100644
index 0000000000..d1f50c5b9c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/breakable-input.js
@@ -0,0 +1,56 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the cases which the input is breakable.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
+ 9. Let endIndex be ! FindBoundary(segmenter, string, n, after).
+
+features: [Intl.Segmenter]
+---*/
+
+// The inputs are breakable for "grapheme" and "word" but not for "sentence"
+const granularities = [undefined, "grapheme", "word"];
+// The following all contains more than one segments in either "grapheme" or "word"
+// granularity.
+const inputs = [
+ "123 ",
+ "a ",
+ " a",
+ " \ud800\udc00", // SPACE + surrogate
+ "\ud800\udc00 ", // surrogate + SPACE
+ "\udc00\ud800", // incorrect surrogate- tail + leading
+ "\ud800 ", // only leading surrogate + SPACE
+ "\udc00 ", // only trailing surrogate + SPACE
+ " \ud800", // SPACE + only leading surrogate
+ " \udc00", // SPACE + only trailing surrogate
+ " 台", // SPACE + a Han character
+ "台 ", // a Han character + SPACE
+ "\u0301 ", // a modifier + SPACE
+];
+
+granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ inputs.forEach(function(input) {
+ const segment = segmenter.segment(input);
+ let msg = `granularity: ${granularity} input: ${input}`;
+ const first = segment.containing(0);
+ assert.sameValue(0, first.index, `${msg} containing(0) index`);
+ assert.sameValue(input, first.input, `${msg} containing(0) input`);
+ assert.sameValue(false, first.segment == input,
+ `${msg} containing(0) segment`);
+ const last = segment.containing(input.length - 1);
+ msg += ` containing(${input.length - 1}) `
+ assert.sameValue(true, last.index > 0, `${msg} index > 0`);
+ assert.sameValue(true, last.index < input.length, `${msg} index`);
+ assert.sameValue(input, last.input, `${msg} input`);
+ assert.sameValue(false, last.segment == input, `${msg} segment`);
+ });
+ });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/browser.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/browser.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/index-throws.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/index-throws.js
new file mode 100644
index 0000000000..2948b6a242
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/index-throws.js
@@ -0,0 +1,48 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the cases which the value of index which throws.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 6. Let n be ? ToInteger(index).
+ 7. If n < 0 or n ≥ len, return undefined.
+ 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
+
+ ToInteger ( argument )
+ 1. Let number be ? ToNumber(argument).
+
+ ToNumber ( argument )
+ Symbol | Throw a TypeError exception.
+ BigInt | Throw a TypeError exception.
+
+features: [Intl.Segmenter]
+---*/
+
+const input = "a b c";
+const granularities = [undefined, "grapheme", "word", "sentence"];
+const index_throws = [
+ // Symbol
+ Symbol(),
+ // BigInt
+ 0n,
+ -1n,
+ 1n,
+ BigInt(0),
+ BigInt(1),
+ BigInt(-1),
+ BigInt(input.length),
+];
+
+granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ const segment = segmenter.segment(input);
+ index_throws.forEach(function(index) {
+ assert.throws(TypeError, () => {segment.containing(index);})
+ });
+ });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/iswordlike.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/iswordlike.js
new file mode 100644
index 0000000000..599e95aa27
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/iswordlike.js
@@ -0,0 +1,59 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the isWordLike in the result when granularity is not "word".
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 10. Return ! CreateSegmentDataObject(segmenter, string, startIndex, endIndex).
+
+ CreateSegmentDataObject ( segmenter, string, startIndex, endIndex )
+ 11. If granularity is "word", then
+ a. Let isWordLike be a Boolean value indicating whether the segment in string is "word-like" according to locale segmenter.[[Locale]].
+ b. Perform ! CreateDataPropertyOrThrow(result, "isWordLike", isWordLike).
+
+includes: [compareArray.js]
+features: [Intl.Segmenter]
+---*/
+
+const other_granularities = [undefined, "grapheme", "sentence"];
+// Some text
+const inputs = [
+ "Hello world!", // English
+ "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech
+ "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese
+ "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek
+ "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian
+ "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew,
+ "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic
+ "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi
+ "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil
+ "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu
+ "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese
+ "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai
+ "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese
+ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
+];
+
+other_granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ inputs.forEach(function(input) {
+ const segment = segmenter.segment(input);
+ for (let index = 0; index < input.length; index++) {
+ const result = segment.containing(index);
+ const msg =
+ `granularity: ${granularity} input: ${input} containing(${index})`;
+ assert.sameValue(true, result.index >= 0, `${msg} index >= 0`);
+ assert.sameValue(true, result.index < input.length, `${msg} index`);
+ assert.sameValue("string", typeof result.input, `${msg} input`);
+ assert.sameValue(undefined, result.isWordLike,
+ `${msg} isWordLike should be undefined`);
+ assert.compareArray(Object.getOwnPropertyNames(result), ["segment", "index", "input"]);
+ }
+ });
+ });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/length.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/length.js
new file mode 100644
index 0000000000..e42cf8f308
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/length.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Checks the "length" property of %Segments.prototype%.containing()
+info: |
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+ The Segmenter constructor is a standard built-in property of the Intl object.
+ 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. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are 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: [Intl.Segmenter]
+---*/
+
+const segment = (new Intl.Segmenter()).segment("");
+verifyProperty(segment.containing, "length", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/name.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/name.js
new file mode 100644
index 0000000000..e5d4bb9403
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/name.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Checks the "name" property of %Segments.prototype%.containing ( index )
+info: |
+ %Segments.prototype%.containing ( index )
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2020 Language Specification, 11th edition, clause 17, or successor.
+ 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, this value is the name that is given to the function in this specification.
+ 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: [Intl.Segmenter]
+---*/
+const segment = (new Intl.Segmenter()).segment("");
+verifyProperty(segment.containing, "name", {
+ value: "containing",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/one-index.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/one-index.js
new file mode 100644
index 0000000000..b23683ef99
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/one-index.js
@@ -0,0 +1,70 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the cases which the value of index turn into 1.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 6. Let n be ? ToInteger(index).
+ 7. If n < 0 or n ≥ len, return undefined.
+ 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
+
+ ToInteger ( argument )
+ 1. Let number be ? ToNumber(argument).
+ 2. If number is NaN, +0, or -0, return +0.
+ 4. Let integer be the Number value that is the same sign as number and whose magnitude is floor(abs(number)).
+ 5. If integer is -0, return +0.
+ 6. Return integer.
+
+ ToNumber ( argument )
+ Undefined | Return NaN.
+ Null | Return +0.
+ Boolean | If argument is true, return 1. If argument is false, return +0.
+
+features: [Intl.Segmenter]
+---*/
+
+const input = "a c";
+const granularities = [undefined, "grapheme", "word"];
+const index_to_one = [
+ 1,
+ 1.49,
+ 14.9E-1,
+ 14.9e-1,
+ "1.49",
+ "14.9E-1",
+ "14.9e-1",
+ true,
+ { toString(){ return "1"; } },
+ { valueOf(){ return 1; } },
+ { [Symbol.toPrimitive](){ return 1; } },
+];
+
+// Except granularity: "sentence", check the result.segment is " ".
+granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ const segment = segmenter.segment(input);
+ index_to_one.forEach(function(index) {
+ const result = segment.containing(index);
+ const msg = "granularity: " + granularity + " index: " + index;
+ assert.sameValue(1, result.index, msg + " index");
+ assert.sameValue(" ", result.segment, msg + " segment");
+ assert.sameValue(input, result.input, msg + " input");
+ });
+ });
+
+// For granularity: "sentence", result.segment is input
+const segmenter = new Intl.Segmenter(undefined, {granularity: "sentence"});
+const segment = segmenter.segment(input);
+index_to_one.forEach(function(index) {
+ const result = segment.containing(index);
+ const msg = "granularity: sentence index: " + index;
+ assert.sameValue(0, result.index, msg + " index");
+ assert.sameValue(input, result.segment, msg + " segment");
+ assert.sameValue(input, result.input, msg + " input");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/out-of-bound-index.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/out-of-bound-index.js
new file mode 100644
index 0000000000..196de36d7f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/out-of-bound-index.js
@@ -0,0 +1,56 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the cases which the value of index turn into out of bound.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 6. Let n be ? ToInteger(index).
+ 7. If n < 0 or n ≥ len, return undefined.
+ 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
+
+ ToInteger ( argument )
+ 1. Let number be ? ToNumber(argument).
+ 2. If number is NaN, +0, or -0, return +0.
+ 4. Let integer be the Number value that is the same sign as number and whose magnitude is floor(abs(number)).
+ 5. If integer is -0, return +0.
+ 6. Return integer.
+
+ ToNumber ( argument )
+ String | See grammar and conversion algorithm below.
+
+features: [Intl.Segmenter]
+---*/
+
+const input = "a b c";
+const granularities = [undefined, "grapheme", "word", "sentence"];
+const index_to_out_of_bound = [
+ input.length,
+ input.length + 0.1,
+ -1,
+ -2,
+ "-1",
+ "-2",
+ "-1.1",
+ Infinity,
+ -Infinity,
+ "Infinity",
+ "-Infinity",
+ { toString(){ return "-1"; } },
+ { valueOf(){ return input.length; } },
+ { [Symbol.toPrimitive](){ return -1; } },
+];
+
+granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ const segment = segmenter.segment(input);
+ index_to_out_of_bound.forEach(function(index) {
+ const result = segment.containing(index);
+ assert.sameValue(undefined, result);
+ });
+ });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/prop-desc.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/prop-desc.js
new file mode 100644
index 0000000000..dd39c1862b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/prop-desc.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Checks the "containing" property of the %Segments.prototype% object.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+
+features: [Intl.Segmenter]
+---*/
+
+const segment = (new Intl.Segmenter()).segment("");
+assert.sameValue(
+ typeof segment.containing,
+ "function",
+ "typeof %Segments.prototype%.containing is function"
+);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/shell.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/shell.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/unbreakable-input.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/unbreakable-input.js
new file mode 100644
index 0000000000..bcc43b81f7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/unbreakable-input.js
@@ -0,0 +1,60 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the cases which the input is unbreakable.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
+ 9. Let endIndex be ! FindBoundary(segmenter, string, n, after).
+
+features: [Intl.Segmenter]
+---*/
+
+const granularities = [undefined, "grapheme", "word", "sentence"];
+// The following all contains only one segment in any granularity.
+const inputs = [
+ "a",
+ " ",
+ "\ud800\udc00", // surrogate
+ "\ud800", // only leading surrogate
+ "\udc00", // only trailing surrogate
+ "台", // a Han character
+ "\u0301", // a modifier
+ "a\u0301", // ASCII + a modifier
+ "ซิ่", // a Thai cluster
+ "𐂰", // a Surrogate pair
+ "\uD83D\uDC4B\uD83C\uDFFB", // Emoji short sequence: waving_hand_light_skin_tone
+ "\uD83D\uDC68\uD83C\uDFFB\u200D\uD83E\uDDB0", // Emoji long sequence: man_light_skin_tone_red_hair
+ "\u1102", // Jamo L
+ "\u1162", // Jamo V
+ "\u11A9", // Jamo T
+ "\u1102\u1162", // Jamo LV
+ "\u1102\u1162\u11A9", // Jamo LVT
+ "\u1102\u1102", // Jamo L L
+ "\u1102\u1102\u1162", // Jamo L L V
+ "\u1102\u1102\u1162\u11A9", // Jamo L L V T
+ "\u1162\u1162", // Jamo V V
+ "\u1162\u11A9", // Jamo V T
+ "\u1102\u1162\u1162", // Jamo V V
+ "\u11A9\u11A9", // Jamo T T
+ "\u1102\u1162\u11A9\u11A9", // Jamo LVT T
+];
+
+granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ inputs.forEach(function(input) {
+ const segment = segmenter.segment(input);
+ for (let index = 0; index < input.length; index++) {
+ const result = segment.containing(index);
+ assert.sameValue(0, result.index);
+ assert.sameValue(input, result.input);
+ assert.sameValue(input, result.segment);
+ }
+ });
+ });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/word-iswordlike.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/word-iswordlike.js
new file mode 100644
index 0000000000..3124a65619
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/word-iswordlike.js
@@ -0,0 +1,58 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the isWordLike in the result when granularity is "word".
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 10. Return ! CreateSegmentDataObject(segmenter, string, startIndex, endIndex).
+
+ CreateSegmentDataObject ( segmenter, string, startIndex, endIndex )
+ 11. If granularity is "word", then
+ a. Let isWordLike be a Boolean value indicating whether the segment in string is "word-like" according to locale segmenter.[[Locale]].
+ b. Perform ! CreateDataPropertyOrThrow(result, "isWordLike", isWordLike).
+
+includes: [compareArray.js]
+features: [Intl.Segmenter]
+---*/
+
+// Some text
+const inputs = [
+ "Hello world!", // English
+ "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech
+ "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese
+ "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek
+ "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian
+ "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew,
+ "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic
+ "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi
+ "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil
+ "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu
+ "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese
+ "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai
+ "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese
+ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
+];
+
+const granularity = "word";
+const segmenter = new Intl.Segmenter(undefined, {granularity});
+inputs.forEach(function(input) {
+ const segment = segmenter.segment(input);
+ for (let index = 0; index < input.length; index++) {
+ const result = segment.containing(index);
+ const msg = "granularity: " + granularity + " input: " + input +
+ " containing(" + index + ") ";
+ assert.sameValue(true, result.index >= 0, msg + "index >= 0");
+ assert.sameValue(true, result.index < input.length,
+ msg + "index < " + input.length);
+ assert.sameValue("string", typeof result.input, msg + "input");
+ assert.sameValue("boolean", typeof result.isWordLike,
+ msg + "isWordLike should be boolean");
+ assert.compareArray(Object.getOwnPropertyNames(result),
+ ["segment", "index", "input", "isWordLike"]);
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/zero-index.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/zero-index.js
new file mode 100644
index 0000000000..0e768bd224
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/containing/zero-index.js
@@ -0,0 +1,72 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%segmentsprototype%.containing
+description: Verifies the cases which the value of index turn into 0.
+info: |
+ %Segments.prototype%.containing ( index )
+
+ 6. Let n be ? ToInteger(index).
+ 7. If n < 0 or n ≥ len, return undefined.
+ 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
+
+ ToInteger ( argument )
+ 1. Let number be ? ToNumber(argument).
+ 2. If number is NaN, +0, or -0, return +0.
+ 4. Let integer be the Number value that is the same sign as number and whose magnitude is floor(abs(number)).
+ 5. If integer is -0, return +0.
+ 6. Return integer.
+
+ ToNumber ( argument )
+ Undefined | Return NaN.
+ Null | Return +0.
+ Boolean | If argument is true, return 1. If argument is false, return +0.
+
+features: [Intl.Segmenter]
+---*/
+
+const input = "a b c";
+const granularities = [undefined, "grapheme", "word", "sentence"];
+const index_to_zeros = [
+ 0,
+ -0,
+ NaN,
+ 0.49,
+ -0.49,
+ null,
+ undefined,
+ false,
+ "\ud800\udc00", // surrogate
+ "\ud800", // only leading surrogate
+ "\udc00", // only trailing surrogate
+ "a",
+ "g",
+ "\u00DD",
+ "0",
+ "+0",
+ "-0",
+ "0.49",
+ "+0.49",
+ "-0.49",
+ "4.9e-1",
+ "-4.9e-1",
+ "4.9E-1",
+ "-4.9E-1",
+ { toString(){ return "-0.1"; } },
+ { valueOf(){ return 0.1; } },
+ { [Symbol.toPrimitive](){ return -0.1; } },
+];
+
+granularities.forEach(
+ function(granularity) {
+ const segmenter = new Intl.Segmenter(undefined, {granularity});
+ const segment = segmenter.segment(input);
+ index_to_zeros.forEach(function(index) {
+ const result = segment.containing(index);
+ assert.sameValue(0, result.index);
+ assert.sameValue(input, result.input);
+ });
+ });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/length.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/length.js
new file mode 100644
index 0000000000..21db9d950e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/length.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Checks the "length" property of Intl.Segmenter.prototype.segment().
+info: |
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+ The Segmenter constructor is a standard built-in property of the Intl object.
+ 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. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are 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: [Intl.Segmenter]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype.segment, "length", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/name.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/name.js
new file mode 100644
index 0000000000..823f44f579
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/name.js
@@ -0,0 +1,23 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Checks the "name" property of Intl.Segmenter.prototype.segment().
+info: |
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+ 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, this value is the name that is given to the function in this specification.
+ 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: [Intl.Segmenter]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype.segment, "name", {
+ value: "segment",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/nested-next.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/nested-next.js
new file mode 100644
index 0000000000..6d21985021
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/nested-next.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors, Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%segmentsprototype%-@@iterator
+description: Test to ensure the nested calling of the next method won't caused confusion to each other.
+info: |
+ %Segments.prototype% [ @@iterator ] ()
+ 5. Return ! CreateSegmentIterator(segmenter, string)
+
+ CreateSegmentIterator ( segmenter, string )
+ 1. Let internalSlotsList be « [[IteratingSegmenter]], [[IteratedString]], [[IteratedStringNextSegmentCodeUnitIndex]] ».
+ 2. Let iterator be ! ObjectCreate(%SegmentIterator.prototype%, internalSlotsList).
+ 3. Set iterator.[[IteratingSegmenter]] to segmenter.
+ 4. Set iterator.[[IteratedString]] to string.
+ 5. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to 0.
+ 6. Return iterator.
+
+ %SegmentIterator.prototype%.next ()
+ 5. Let startIndex be iterator.[[IteratedStringNextSegmentCodeUnitIndex]].
+
+features: [Intl.Segmenter]
+---*/
+
+const segmenter = new Intl.Segmenter();
+const input = "ABCD";
+const segments = segmenter.segment(input);
+let result = "";
+for (let v1 of segments) {
+ for (let v2 of segments) {
+ result += v1.segment;
+ result += v2.segment;
+ }
+ result += ":";
+}
+assert.sameValue("AAABACAD:BABBBCBD:CACBCCCD:DADBDCDD:", result);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/next-inside-next.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/next-inside-next.js
new file mode 100644
index 0000000000..2936d7621e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/next-inside-next.js
@@ -0,0 +1,50 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors, Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%segmentsprototype%-@@iterator
+description: Test to ensure the next on two segments of the segmenter won't interfer each other.
+info: |
+ %Segments.prototype% [ @@iterator ] ()
+ 5. Return ! CreateSegmentIterator(segmenter, string)
+
+ CreateSegmentIterator ( segmenter, string )
+ 1. Let internalSlotsList be « [[IteratingSegmenter]], [[IteratedString]], [[IteratedStringNextSegmentCodeUnitIndex]] ».
+ 2. Let iterator be ! ObjectCreate(%SegmentIterator.prototype%, internalSlotsList).
+ 3. Set iterator.[[IteratingSegmenter]] to segmenter.
+ 4. Set iterator.[[IteratedString]] to string.
+ 5. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to 0.
+ 6. Return iterator.
+
+ %SegmentIterator.prototype%.next ()
+ 5. Let startIndex be iterator.[[IteratedStringNextSegmentCodeUnitIndex]].
+
+features: [Intl.Segmenter]
+---*/
+
+const segmenter = new Intl.Segmenter();
+const input1 = "ABCD";
+const input2 = "123";
+const segments1 = segmenter.segment(input1);
+const segments2 = segmenter.segment(input2);
+let result = "";
+for (let v1 of segments1) {
+ for (let v2 of segments2) {
+ result += v1.segment;
+ result += v2.segment;
+ }
+ result += ":";
+}
+// Now loop segments2 .
+for (let v2 of segments2) {
+ for (let v1 of segments1) {
+ result += v2.segment;
+ result += v1.segment;
+ }
+ result += ":";
+}
+assert.sameValue(
+ "A1A2A3:B1B2B3:C1C2C3:D1D2D3:1A1B1C1D:2A2B2C2D:3A3B3C3D:", result);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/next-mix-with-containing.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/next-mix-with-containing.js
new file mode 100644
index 0000000000..dcc231c12b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/next-mix-with-containing.js
@@ -0,0 +1,55 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2020 the V8 project authors, Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%segmentsprototype%-@@iterator
+description: Test to ensure the the calling of containing() won't impact the calling of the next().
+info: |
+ %Segments.prototype% [ @@iterator ] ()
+ 5. Return ! CreateSegmentIterator(segmenter, string)
+
+ CreateSegmentIterator ( segmenter, string )
+ 1. Let internalSlotsList be « [[IteratingSegmenter]], [[IteratedString]], [[IteratedStringNextSegmentCodeUnitIndex]] ».
+ 2. Let iterator be ! ObjectCreate(%SegmentIterator.prototype%, internalSlotsList).
+ 3. Set iterator.[[IteratingSegmenter]] to segmenter.
+ 4. Set iterator.[[IteratedString]] to string.
+ 5. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to 0.
+ 6. Return iterator.
+
+ %SegmentIterator.prototype%.next ()
+ 5. Let startIndex be iterator.[[IteratedStringNextSegmentCodeUnitIndex]].
+
+ %Segments.prototype%.containing ( index )
+ 3. Let segmenter be segments.[[SegmentsSegmenter]].
+ 4. Let string be segments.[[SegmentsString]].
+
+
+features: [Intl.Segmenter]
+---*/
+
+const segmenter = new Intl.Segmenter();
+const input = "ABC";
+const segments = segmenter.segment(input);
+let next_result = "";
+for (let i = 0; i < input.length; i++) {
+ let containing_result = segments.containing(i);
+ let msg = "containing(" + i + ") before the loop. ";
+ assert.sameValue(input[i], containing_result.segment, msg + "segment");
+ assert.sameValue(i, containing_result.index, msg + "index");
+ assert.sameValue(input, containing_result.input, msg + "input");
+ for (let v of segments) {
+ next_result += v.segment;
+ next_result += ":";
+ // Ensure the value n passing into segments.containing(n) will not impact
+ // the result of next().
+ msg = "containing(" + i + ") inside the loop. ";
+ containing_result = segments.containing(i);
+ assert.sameValue(input[i], containing_result.segment, msg + "segment");
+ assert.sameValue(i, containing_result.index, msg + "index");
+ assert.sameValue(input, containing_result.input, msg + "input");
+ }
+}
+assert.sameValue("A:B:C:A:B:C:A:B:C:", next_result);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/prop-desc.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/prop-desc.js
new file mode 100644
index 0000000000..d760eab7e5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/prop-desc.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Checks the "segment" property of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.segment( string )
+
+ Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
+
+ Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+features: [Intl.Segmenter]
+---*/
+
+assert.sameValue(
+ typeof Intl.Segmenter.prototype.segment,
+ "function",
+ "typeof Intl.Segmenter.prototype.segment is function"
+);
+
+verifyProperty(Intl.Segmenter.prototype, "segment", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js
new file mode 100644
index 0000000000..5b3766ff3a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js
@@ -0,0 +1,57 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Copyright 2020 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Verifies the behavior for the "segment" function of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.segment( string )
+includes: [compareArray.js]
+features: [Intl.Segmenter]
+---*/
+
+const seg = new Intl.Segmenter([], {granularity: "grapheme"})
+for (const text of [
+ "Hello world!", // English
+ " Hello world! ", // English with space before/after
+ " Hello world? Foo bar!", // English
+ "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech
+ "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese
+ "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek
+ "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian
+ "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew,
+ "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic
+ "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi
+ "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil
+ "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu
+ "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese
+ "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai
+ "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese
+ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
+ ]) {
+ let segments = [];
+ for (const v of seg.segment(text)) {
+ assert.sameValue("string", typeof v.segment);
+ assert.sameValue(true, v.segment.length > 0, "length > 0");
+
+ assert.sameValue("number", typeof v.index);
+ assert.sameValue(true, v.index >= 0, "index >= 0");
+ assert.sameValue(true, v.index < text.length, "index < input.length");
+
+ assert.sameValue("string", typeof v.input);
+ assert.sameValue(text, v.input);
+
+ assert.sameValue(undefined, v.isWordLike);
+ assert.sameValue(false, v.hasOwnProperty("isWordLike"));
+
+ assert.sameValue(text.slice(v.index, v.index + v.segment.length), v.segment);
+ assert.compareArray(Object.getOwnPropertyNames(v), ["segment", "index", "input"]);
+
+ segments.push(v.segment);
+ }
+ assert.sameValue(text, segments.join(''));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js
new file mode 100644
index 0000000000..706e49b4c5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js
@@ -0,0 +1,57 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Copyright 2020 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Verifies the behavior for the "segment" function of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.segment( string )
+includes: [compareArray.js]
+features: [Intl.Segmenter]
+---*/
+
+const seg = new Intl.Segmenter([], {granularity: "sentence"})
+for (const text of [
+ "Hello world!", // English
+ " Hello world! ", // English with space before/after
+ " Hello world? Foo bar!", // English
+ "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech
+ "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese
+ "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek
+ "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian
+ "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew,
+ "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic
+ "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi
+ "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil
+ "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu
+ "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese
+ "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai
+ "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese
+ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
+ ]) {
+ let segments = [];
+ for (const v of seg.segment(text)) {
+ assert.sameValue("string", typeof v.segment);
+ assert.sameValue(true, v.segment.length > 0, "length > 0");
+
+ assert.sameValue("number", typeof v.index);
+ assert.sameValue(true, v.index >= 0, "index >= 0");
+ assert.sameValue(true, v.index < text.length, "index < input.length");
+
+ assert.sameValue("string", typeof v.input);
+ assert.sameValue(text, v.input);
+
+ assert.sameValue(undefined, v.isWordLike);
+ assert.sameValue(false, v.hasOwnProperty("isWordLike"));
+
+ assert.sameValue(text.slice(v.index, v.index + v.segment.length), v.segment);
+ assert.compareArray(Object.getOwnPropertyNames(v), ["segment", "index", "input"]);
+
+ segments.push(v.segment);
+ }
+ assert.sameValue(text, segments.join(''));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-tostring.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-tostring.js
new file mode 100644
index 0000000000..433cd9ad44
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-tostring.js
@@ -0,0 +1,37 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 the V8 project authors, Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Verifies the string coercion in the "segment" function of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.segment( string )
+
+ 3. Let string be ? ToString(string).
+features: [Intl.Segmenter]
+---*/
+
+const tests = [
+ [[], "undefined"],
+ [[undefined], "undefined"],
+ [[null], "null"],
+ [[true], "true"],
+ [[false], "false"],
+ [[12], "12"],
+ [[1.23], "1.23"],
+ [[["a", "b"]], "a"],
+ [[{}], "["], // "[object Object]"
+];
+
+const segmenter = new Intl.Segmenter("en", { "granularity": "word" });
+for (const [args, expected] of tests) {
+ const segments = segmenter.segment(...args);
+ const actual = [...segments][0].segment;
+ assert.sameValue(actual, expected, `Expected segment "${expected}", found "${actual}" for arguments ${args}`);
+}
+
+const symbol = Symbol();
+assert.throws(TypeError, () => segmenter.segment(symbol));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-word-iterable.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-word-iterable.js
new file mode 100644
index 0000000000..af7b9598d5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/segment-word-iterable.js
@@ -0,0 +1,57 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Copyright 2020 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Segmenter.prototype.segment
+description: Verifies the behavior for the "segment" function of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype.segment( string )
+includes: [compareArray.js]
+features: [Intl.Segmenter]
+---*/
+
+const seg = new Intl.Segmenter([], {granularity: "word"})
+for (const text of [
+ "Hello world!", // English
+ " Hello world! ", // English with space before/after
+ " Hello world? Foo bar!", // English
+ "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech
+ "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese
+ "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek
+ "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian
+ "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew,
+ "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic
+ "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi
+ "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil
+ "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu
+ "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese
+ "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai
+ "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese
+ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
+ ]) {
+ let segments = [];
+ for (const v of seg.segment(text)) {
+ assert.sameValue("string", typeof v.segment);
+ assert.sameValue(true, v.segment.length > 0, "length > 0");
+
+ assert.sameValue("number", typeof v.index);
+ assert.sameValue(true, v.index >= 0, "index >= 0");
+ assert.sameValue(true, v.index < text.length, "index < input.length");
+
+ assert.sameValue("string", typeof v.input);
+ assert.sameValue(text, v.input);
+
+ assert.sameValue("boolean", typeof v.isWordLike);
+ assert.sameValue(true, v.hasOwnProperty("isWordLike"));
+
+ assert.sameValue(text.slice(v.index, v.index + v.segment.length), v.segment);
+ assert.compareArray(Object.getOwnPropertyNames(v), ["segment", "index", "input", "isWordLike"]);
+
+ segments.push(v.segment);
+ }
+ assert.sameValue(text, segments.join(''));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/segment/shell.js b/js/src/tests/test262/intl402/Segmenter/prototype/segment/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/segment/shell.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/shell.js b/js/src/tests/test262/intl402/Segmenter/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/shell.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/browser.js b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/browser.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/shell.js b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/shell.js
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toString.js b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toString.js
new file mode 100644
index 0000000000..b2bb14f326
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toString.js
@@ -0,0 +1,19 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.Segmenter.prototype-@@tostringtag
+description: >
+ Checks Object.prototype.toString with Intl.Segmenter objects.
+info: |
+ Intl.Segmenter.prototype[ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the string value "Intl.Segmenter".
+features: [Intl.Segmenter]
+---*/
+
+assert.sameValue(Object.prototype.toString.call(Intl.Segmenter.prototype), "[object Intl.Segmenter]");
+assert.sameValue(Object.prototype.toString.call(new Intl.Segmenter()), "[object Intl.Segmenter]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toStringTag.js b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toStringTag.js
new file mode 100644
index 0000000000..a5ce6a1c39
--- /dev/null
+++ b/js/src/tests/test262/intl402/Segmenter/prototype/toStringTag/toStringTag.js
@@ -0,0 +1,26 @@
+// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.Segmenter.prototype-@@tostringtag
+description: >
+ Checks the @@toStringTag property of the Segmenter prototype object.
+info: |
+ Intl.Segmenter.prototype[ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the string value "Intl.Segmenter".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.Segmenter, Symbol.toStringTag]
+---*/
+
+verifyProperty(Intl.Segmenter.prototype, Symbol.toStringTag, {
+ value: "Intl.Segmenter",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);