summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Collator/prototype
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/intl402/Collator/prototype
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/Collator/prototype')
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/builtin.js18
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/bound-to-collator-instance.js33
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/builtin.js32
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/canonically-equivalent-strings.js69
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-builtin.js33
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-length.js31
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-name.js28
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-property-order.js18
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/ignorePunctuation.js19
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/length.js36
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/name.js31
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-basic.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-phonebook.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-sensitivity.js36
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/prop-desc.js39
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/compare/shell.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/constructor/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/constructor/prop-desc.js33
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/constructor/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/constructor/value.js13
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/prop-desc.js17
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/basic.js50
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/builtin.js30
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-not-default.js17
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/length.js34
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/name.js29
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/order.js34
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/prop-desc.js33
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/shell.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/this-value-collator-prototype.js16
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/this-value-not-collator.js28
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/toStringTag/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/toStringTag/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-changed-tag.js30
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-removed-tag.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString.js26
-rw-r--r--js/src/tests/test262/intl402/Collator/prototype/toStringTag/toStringTag.js25
41 files changed, 958 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Collator/prototype/browser.js b/js/src/tests/test262/intl402/Collator/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/browser.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/builtin.js b/js/src/tests/test262/intl402/Collator/prototype/builtin.js
new file mode 100644
index 0000000000..d43c58095d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/builtin.js
@@ -0,0 +1,18 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.3_L15
+description: >
+ Tests that Intl.Collator.prototype meets the requirements for
+ built-in objects defined by the introduction of chapter 17 of the
+ ECMAScript Language Specification.
+author: Norbert Lindenberg
+---*/
+
+assert(Object.isExtensible(Intl.Collator.prototype), "Built-in objects must be extensible.");
+
+assert.sameValue(Object.getPrototypeOf(Intl.Collator.prototype), Object.prototype,
+ "Built-in prototype objects must have Object.prototype as their prototype.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/bound-to-collator-instance.js b/js/src/tests/test262/intl402/Collator/prototype/compare/bound-to-collator-instance.js
new file mode 100644
index 0000000000..a5d3716700
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/bound-to-collator-instance.js
@@ -0,0 +1,33 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_1_c
+description: Tests that compare function is bound to its Intl.Collator.
+author: Norbert Lindenberg
+includes: [compareArray.js]
+---*/
+
+var strings = ["d", "O", "od", "oe", "of", "ö", "o\u0308", "X", "y", "Z", "Z.", "𠮷野家", "吉野家", "!A", "A", "b", "C"];
+var locales = [undefined, ["de"], ["de-u-co-phonebk"], ["en"], ["ja"], ["sv"]];
+var options = [
+ undefined,
+ {usage: "search"},
+ {sensitivity: "base", ignorePunctuation: true}
+];
+
+locales.forEach(function (locales) {
+ options.forEach(function (options) {
+ var collatorObj = new Intl.Collator(locales, options);
+ var compareFunc = collatorObj.compare;
+ var referenceSorted = strings.slice();
+ referenceSorted.sort(function (a, b) { return collatorObj.compare(a, b); });
+ var sorted = strings;
+ sorted.sort(compareFunc);
+ assert.compareArray(sorted, referenceSorted,
+ "(Testing with locales " + locales + "; options " +
+ (options ? JSON.stringify(options) : options) + ".)");
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/browser.js b/js/src/tests/test262/intl402/Collator/prototype/compare/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/browser.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/builtin.js b/js/src/tests/test262/intl402/Collator/prototype/compare/builtin.js
new file mode 100644
index 0000000000..11ccc40a7b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/builtin.js
@@ -0,0 +1,32 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_L15
+description: >
+ Tests that the getter for Intl.Collator.prototype.compare meets
+ the requirements for built-in objects defined by the introduction
+ of chapter 17 of the ECMAScript Language Specification.
+author: Norbert Lindenberg
+includes: [isConstructor.js]
+features: [Reflect.construct]
+---*/
+
+var compareFn = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get;
+
+assert.sameValue(Object.prototype.toString.call(compareFn), "[object Function]",
+ "The [[Class]] internal property of a built-in function must be " +
+ "\"Function\".");
+
+assert(Object.isExtensible(compareFn),
+ "Built-in objects must be extensible.");
+
+assert.sameValue(Object.getPrototypeOf(compareFn), Function.prototype);
+
+assert.sameValue(compareFn.hasOwnProperty("prototype"), false,
+ "Built-in functions that aren't constructors must not have a prototype property.");
+
+assert.sameValue(isConstructor(compareFn), false,
+ "Built-in functions don't implement [[Construct]] unless explicitly specified.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/canonically-equivalent-strings.js b/js/src/tests/test262/intl402/Collator/prototype/compare/canonically-equivalent-strings.js
new file mode 100644
index 0000000000..a0994462b7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/canonically-equivalent-strings.js
@@ -0,0 +1,69 @@
+// Copyright 2012 Norbert Lindenberg. All rights reserved.
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_CS_a
+description: >
+ Tests that the function returned by
+ Intl.Collator.prototype.compare returns 0 when comparing Strings
+ that are considered canonically equivalent by the Unicode
+ standard.
+author: Norbert Lindenberg
+---*/
+
+var collator = new Intl.Collator();
+var pairs = [
+ // example from Unicode 5.0, section 3.7, definition D70
+ ["o\u0308", "ö"],
+ // examples from Unicode 5.0, chapter 3.11
+ ["ä\u0323", "a\u0323\u0308"],
+ ["a\u0308\u0323", "a\u0323\u0308"],
+ ["ạ\u0308", "a\u0323\u0308"],
+ ["ä\u0306", "a\u0308\u0306"],
+ ["ă\u0308", "a\u0306\u0308"],
+ // example from Unicode 5.0, chapter 3.12
+ ["\u1111\u1171\u11B6", "퓛"],
+ // examples from UTS 10, Unicode Collation Algorithm
+ ["Å", "Å"],
+ ["Å", "A\u030A"],
+ ["x\u031B\u0323", "x\u0323\u031B"],
+ ["ự", "ụ\u031B"],
+ ["ự", "u\u031B\u0323"],
+ ["ự", "ư\u0323"],
+ ["ự", "u\u0323\u031B"],
+ // examples from UAX 15, Unicode Normalization Forms
+ ["Ç", "C\u0327"],
+ ["q\u0307\u0323", "q\u0323\u0307"],
+ ["가", "\u1100\u1161"],
+ ["Å", "A\u030A"],
+ ["Ω", "Ω"],
+ ["Å", "A\u030A"],
+ ["ô", "o\u0302"],
+ ["ṩ", "s\u0323\u0307"],
+ ["ḋ\u0323", "d\u0323\u0307"],
+ ["ḋ\u0323", "ḍ\u0307"],
+ ["q\u0307\u0323", "q\u0323\u0307"],
+ // examples involving supplementary characters from UCD NormalizationTest.txt
+ ["\uD834\uDD5E", "\uD834\uDD57\uD834\uDD65"],
+ ["\uD87E\uDC2B", "北"]
+
+];
+var i;
+for (i = 0; i < pairs.length; i++) {
+ var pair = pairs[i];
+ assert.sameValue(collator.compare(pair[0], pair[1]), 0, "Collator.compare considers " + pair[0] + " (" + toU(pair[0]) + ") ≠ " + pair[1] + " (" + toU(pair[1]) + ").");
+}
+
+function toU(s) {
+ var result = "";
+ var escape = "\\u0000";
+ var i;
+ for (i = 0; i < s.length; i++) {
+ var hex = s.charCodeAt(i).toString(16);
+ result += escape.substring(0, escape.length - hex.length) + hex;
+ }
+ return result;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-builtin.js b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-builtin.js
new file mode 100644
index 0000000000..3b6ec70b35
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-builtin.js
@@ -0,0 +1,33 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_1_a_L15
+description: >
+ Tests that the function returned by
+ Intl.Collator.prototype.compare meets the requirements for
+ built-in objects defined by the introduction of chapter 17 of the
+ ECMAScript Language Specification.
+author: Norbert Lindenberg
+includes: [isConstructor.js]
+features: [Reflect.construct]
+---*/
+
+var compareFn = new Intl.Collator().compare;
+
+assert.sameValue(Object.prototype.toString.call(compareFn), "[object Function]",
+ "The [[Class]] internal property of a built-in function must be " +
+ "\"Function\".");
+
+assert(Object.isExtensible(compareFn),
+ "Built-in objects must be extensible.");
+
+assert.sameValue(Object.getPrototypeOf(compareFn), Function.prototype);
+
+assert.sameValue(compareFn.hasOwnProperty("prototype"), false,
+ "Built-in functions that aren't constructors must not have a prototype property.");
+
+assert.sameValue(isConstructor(compareFn), false,
+ "Built-in functions don't implement [[Construct]] unless explicitly specified.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-length.js b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-length.js
new file mode 100644
index 0000000000..8fab13ccf5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-length.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.compare
+description: >
+ The length of the bound Collator compare function is 2.
+info: |
+ get Intl.Collator.prototype.compare
+
+ ...
+ 4. If collator.[[BoundCompare]] is undefined, then
+ a. Let F be a new built-in function object as defined in 10.3.4.
+ b. Let bc be BoundFunctionCreate(F, collator, « »).
+ c. Perform ! DefinePropertyOrThrow(bc, "length", PropertyDescriptor {[[Value]]: 2,
+ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ ...
+
+includes: [propertyHelper.js]
+---*/
+
+var compareFn = new Intl.Collator().compare;
+
+verifyProperty(compareFn, "length", {
+ value: 2,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-name.js b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-name.js
new file mode 100644
index 0000000000..234ef6ad27
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Collator.prototype.compare
+description: >
+ The bound Collator compare function is an anonymous function.
+info: |
+ 10.3.3 get Intl.Collator.prototype.compare
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in function object, including constructors, has a `name`
+ property whose value is a String. Functions that are identified as
+ anonymous functions use the empty string as the value of the `name`
+ property.
+ Unless otherwise specified, the `name` property of a built-in function
+ object has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*,
+ [[Configurable]]: *true* }.
+includes: [propertyHelper.js]
+---*/
+
+var compareFn = new Intl.Collator().compare;
+
+verifyProperty(compareFn, "name", {
+ value: "", writable: false, enumerable: false, configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-property-order.js b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-property-order.js
new file mode 100644
index 0000000000..8ef4ba381d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/compare-function-property-order.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-createbuiltinfunction
+description: Collator bound compare function property order
+info: |
+ Set order: "length", "name"
+includes: [compareArray.js]
+---*/
+
+var compareFn = new Intl.Collator().compare;
+
+assert.compareArray(
+ Object.getOwnPropertyNames(compareFn),
+ ['length', 'name']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/ignorePunctuation.js b/js/src/tests/test262/intl402/Collator/prototype/compare/ignorePunctuation.js
new file mode 100644
index 0000000000..e4fc3b75f1
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/ignorePunctuation.js
@@ -0,0 +1,19 @@
+// Copyright 2023 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-collator-comparestrings
+description: test CompareStrings sync with resolvedOptions().ignorePunctuation.
+locale: [en, th, ja]
+---*/
+// test on three locales, 'th' has different default.
+['en', 'th', 'ja'].forEach((locale) => {
+ [undefined, true, false].forEach((ignorePunctuation) => {
+ let col = new Intl.Collator(locale, {ignorePunctuation});
+ // if ignorePunctuation is true, the comparison will be 0
+ let expected = col.resolvedOptions().ignorePunctuation ? 0 : -1;
+ assert.sameValue(col.compare("", " "), expected, "Compare to space");
+ assert.sameValue(col.compare("", "*"), expected, "Compare to star");
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/length.js b/js/src/tests/test262/intl402/Collator/prototype/compare/length.js
new file mode 100644
index 0000000000..3966c60a65
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/length.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.compare
+description: >
+ get Intl.Collator.prototype.compare.length is 0.
+info: |
+ get Intl.Collator.prototype.compare
+
+ 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. 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]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare");
+
+verifyProperty(desc.get, "length", {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/name.js b/js/src/tests/test262/intl402/Collator/prototype/compare/name.js
new file mode 100644
index 0000000000..05cad26fe3
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/name.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Collator.prototype.compare
+description: >
+ get Intl.Collator.prototype.compare.name is "get compare".
+info: |
+ 10.3.3 get Intl.Collator.prototype.compare
+
+ 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 desc = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare");
+
+verifyProperty(desc.get, "name", {
+ value: "get compare",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-basic.js b/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-basic.js
new file mode 100644
index 0000000000..8243ddfd44
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-basic.js
@@ -0,0 +1,24 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_CS_b_NN
+description: >
+ Tests that the compare function isn't entirely unreasonable. This
+ test is not normative.
+author: Norbert Lindenberg
+includes: [compareArray.js]
+---*/
+
+// this test should be valid at least for the following locales
+var locales = ["de", "en", "es", "fr", "it"];
+locales = Intl.Collator.supportedLocalesOf(locales, {localeMatcher: "lookup"});
+locales.forEach(function (locale) {
+ var collator = new Intl.Collator([locale], {sensitivity: "variant", localeMatcher: "lookup"});
+ var a = ["L", "X", "C", "k", "Z", "H", "d", "m", "w", "A", "i", "f", "y", "E", "N", "V", "g", "J", "b"];
+ a.sort(collator.compare);
+ var expected = ["A", "b", "C", "d", "E", "f", "g", "H", "i", "J", "k", "L", "m", "N", "V", "w", "X", "y", "Z"];
+ assert.compareArray(a, expected);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-phonebook.js b/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-phonebook.js
new file mode 100644
index 0000000000..47d330eba2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-phonebook.js
@@ -0,0 +1,24 @@
+// Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_CS_c_NN
+description: >
+ Tests that the compare function supports phonebook sorting if it
+ says it does. This test is not normative.
+author: Norbert Lindenberg
+includes: [compareArray.js]
+---*/
+
+// this test should be valid at least for the following locales
+var locales = ["de-DE-u-co-phonebk", "de-u-co-phonebk"];
+var collator = new Intl.Collator(locales, {localeMatcher: "lookup"});
+if (locales.indexOf(collator.resolvedOptions().locale) !== -1) {
+ var a = ["A", "b", "Af", "Ab", "od", "off", "Ä", "ö"];
+ a.sort(collator.compare);
+ var expected = ["A", "Ab", "Ä", "Af", "b", "od", "ö", "off"];
+ assert.compareArray(a, expected);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-sensitivity.js b/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-sensitivity.js
new file mode 100644
index 0000000000..8c5e70ba87
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/non-normative-sensitivity.js
@@ -0,0 +1,36 @@
+// Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.3.2_CS_d_NN
+description: >
+ Tests that the compare function supports different sensitivity
+ settings. This test is not normative.
+author: Norbert Lindenberg
+includes: [compareArray.js]
+---*/
+
+// this test should be valid at least for the following locales
+var locales = ["de", "en", "es", "it"];
+locales = Intl.Collator.supportedLocalesOf(locales, {localeMatcher: "lookup"});
+locales.forEach(function (locale) {
+ var target = "Aa";
+ var input = ["Aa", "bA", "E", "b", "aA", "fC", "áÁ", "Aã"];
+ var expected = {
+ "base": ["Aa", "aA", "áÁ", "Aã"],
+ "accent": ["Aa", "aA"],
+ "case": ["Aa", "Aã"],
+ "variant": ["Aa"]
+ };
+ Object.getOwnPropertyNames(expected).forEach(function (sensitivity) {
+ var collator = new Intl.Collator([locale], {usage: "search",
+ sensitivity: sensitivity, localeMatcher: "lookup"});
+ var matches = input.filter(function (v) {
+ return collator.compare(v, target) === 0;
+ });
+ assert.compareArray(matches, expected[sensitivity]);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/prop-desc.js b/js/src/tests/test262/intl402/Collator/prototype/compare/prop-desc.js
new file mode 100644
index 0000000000..ad9a6d5174
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/prop-desc.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.resolvedoptions
+description: >
+ "compare" property of Intl.Collator.prototype.
+info: |
+ get Intl.Collator.prototype.compare
+
+ 7 Requirements for Standard Built-in ECMAScript Objects
+
+ 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 2018 Language
+ Specification, 9th edition, clause 17, or successor.
+
+ 17 ECMAScript Standard Built-in Objects:
+
+ Every accessor property described in clauses 18 through 26 and in Annex B.2 has the
+ attributes { [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+ If only a get accessor function is described, the set accessor function is the default
+ value, undefined. If only a set accessor is described the get accessor is the default
+ value, undefined.
+
+includes: [propertyHelper.js]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare");
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, "function");
+
+verifyProperty(Intl.Collator.prototype, "compare", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/compare/shell.js b/js/src/tests/test262/intl402/Collator/prototype/compare/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/compare/shell.js
@@ -0,0 +1,24 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/intl402/Collator/prototype/constructor/browser.js b/js/src/tests/test262/intl402/Collator/prototype/constructor/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/constructor/browser.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/constructor/prop-desc.js b/js/src/tests/test262/intl402/Collator/prototype/constructor/prop-desc.js
new file mode 100644
index 0000000000..402a772656
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/constructor/prop-desc.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.constructor
+description: >
+ "constructor" property of Intl.Collator.prototype.
+info: |
+ Intl.Collator.prototype.constructor
+
+ 7 Requirements for Standard Built-in ECMAScript Objects
+
+ 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 2018 Language
+ Specification, 9th edition, clause 17, or successor.
+
+ 17 ECMAScript Standard Built-in Objects:
+
+ 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]
+---*/
+
+verifyProperty(Intl.Collator.prototype, "constructor", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/constructor/shell.js b/js/src/tests/test262/intl402/Collator/prototype/constructor/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/constructor/shell.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/constructor/value.js b/js/src/tests/test262/intl402/Collator/prototype/constructor/value.js
new file mode 100644
index 0000000000..37cb53b0c5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/constructor/value.js
@@ -0,0 +1,13 @@
+// Copyright 2012 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.3.1
+description: >
+ Tests that Intl.Collator.prototype.constructor is the
+ Intl.Collator.
+---*/
+
+assert.sameValue(Intl.Collator.prototype.constructor, Intl.Collator, "Intl.Collator.prototype.constructor is not the same as Intl.Collator");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/prop-desc.js b/js/src/tests/test262/intl402/Collator/prototype/prop-desc.js
new file mode 100644
index 0000000000..52e6fec6b3
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/prop-desc.js
@@ -0,0 +1,17 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.2.1
+description: Tests that Intl.Collator.prototype has the required attributes.
+author: Norbert Lindenberg
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(Intl.Collator, "prototype", {
+ writable: false,
+ enumerable: false,
+ configurable: false,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/basic.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/basic.js
new file mode 100644
index 0000000000..eb59055e28
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/basic.js
@@ -0,0 +1,50 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.3.3
+description: >
+ Tests that the object returned by
+ Intl.Collator.prototype.resolvedOptions has the right properties.
+author: Norbert Lindenberg
+includes: [testIntl.js, propertyHelper.js]
+---*/
+
+var actual = new Intl.Collator().resolvedOptions();
+
+var actual2 = new Intl.Collator().resolvedOptions();
+assert.notSameValue(actual2, actual, "resolvedOptions returned the same object twice.");
+
+var collations = ["default", ...allCollations()];
+
+// this assumes the default values where the specification provides them
+assert(isCanonicalizedStructurallyValidLanguageTag(actual.locale),
+ "Invalid locale: " + actual.locale);
+assert.sameValue(actual.usage, "sort");
+assert.sameValue(actual.sensitivity, "variant");
+assert.sameValue(actual.ignorePunctuation, false);
+assert.notSameValue(actual.collation, "search");
+assert.notSameValue(actual.collation, "standard");
+assert.notSameValue(collations.indexOf(actual.collation), -1,
+ "Invalid collation: " + actual.collation);
+
+var dataPropertyDesc = { writable: true, enumerable: true, configurable: true };
+verifyProperty(actual, "locale", dataPropertyDesc);
+verifyProperty(actual, "usage", dataPropertyDesc);
+verifyProperty(actual, "sensitivity", dataPropertyDesc);
+verifyProperty(actual, "ignorePunctuation", dataPropertyDesc);
+verifyProperty(actual, "collation", dataPropertyDesc);
+
+// "numeric" is an optional property.
+if (actual.hasOwnProperty("numeric")) {
+ assert.notSameValue([true, false].indexOf(actual.numeric), -1);
+ verifyProperty(actual, "numeric", dataPropertyDesc);
+}
+
+// "caseFirst" is an optional property.
+if (actual.hasOwnProperty("caseFirst")) {
+ assert.notSameValue(["upper", "lower", "false"].indexOf(actual.caseFirst), -1);
+ verifyProperty(actual, "caseFirst", dataPropertyDesc);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/browser.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/browser.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/builtin.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/builtin.js
new file mode 100644
index 0000000000..6fef5829f6
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/builtin.js
@@ -0,0 +1,30 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.3.3_L15
+description: >
+ Tests that Intl.Collator.prototype.resolvedOptions meets the
+ requirements for built-in objects defined by the introduction of
+ chapter 17 of the ECMAScript Language Specification.
+author: Norbert Lindenberg
+includes: [isConstructor.js]
+features: [Reflect.construct]
+---*/
+
+assert.sameValue(Object.prototype.toString.call(Intl.Collator.prototype.resolvedOptions), "[object Function]",
+ "The [[Class]] internal property of a built-in function must be " +
+ "\"Function\".");
+
+assert(Object.isExtensible(Intl.Collator.prototype.resolvedOptions),
+ "Built-in objects must be extensible.");
+
+assert.sameValue(Object.getPrototypeOf(Intl.Collator.prototype.resolvedOptions), Function.prototype);
+
+assert.sameValue(Intl.Collator.prototype.resolvedOptions.hasOwnProperty("prototype"), false,
+ "Built-in functions that aren't constructors must not have a prototype property.");
+
+assert.sameValue(isConstructor(Intl.Collator.prototype.resolvedOptions), false,
+ "Built-in functions don't implement [[Construct]] unless explicitly specified.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-not-default.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-not-default.js
new file mode 100644
index 0000000000..ff77cf814e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-not-default.js
@@ -0,0 +1,17 @@
+// Copyright 2023 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-initializecollator
+description: resolved ignorePunctuation is the same as the one specified in option bag.
+locale: [en, th, ja]
+---*/
+['en', 'th', 'ja'].forEach((locale) => {
+ [true, false].forEach((ignorePunctuation) => {
+ assert.sameValue(
+ (new Intl.Collator(locale, {ignorePunctuation}))
+ .resolvedOptions().ignorePunctuation,
+ ignorePunctuation);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/length.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/length.js
new file mode 100644
index 0000000000..ce9b4ff150
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/length.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.resolvedoptions
+description: >
+ Intl.Collator.prototype.resolvedOptions.length is 0.
+info: |
+ Intl.Collator.prototype.resolvedOptions ()
+
+ 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. 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]
+---*/
+
+verifyProperty(Intl.Collator.prototype.resolvedOptions, "length", {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/name.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/name.js
new file mode 100644
index 0000000000..317f275e3b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Collator.prototype.resolvedOptions
+description: >
+ Intl.Collator.prototype.resolvedOptions.name is "resolvedOptions".
+info: |
+ 10.3.5 Intl.Collator.prototype.resolvedOptions ()
+
+ 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]
+---*/
+
+verifyProperty(Intl.Collator.prototype.resolvedOptions, "name", {
+ value: "resolvedOptions",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/order.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/order.js
new file mode 100644
index 0000000000..edc6adbc29
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/order.js
@@ -0,0 +1,34 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.resolvedoptions
+description: Verifies the property order for the object returned by resolvedOptions().
+---*/
+
+const options = new Intl.Collator([], {
+ "numeric": true,
+ "caseFirst": "upper",
+}).resolvedOptions();
+
+const expected = [
+ "locale",
+ "usage",
+ "sensitivity",
+ "ignorePunctuation",
+ "collation",
+ "numeric",
+ "caseFirst"
+];
+
+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/Collator/prototype/resolvedOptions/prop-desc.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/prop-desc.js
new file mode 100644
index 0000000000..5c947f53f8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/prop-desc.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype.resolvedoptions
+description: >
+ "resolvedOptions" property of Intl.Collator.prototype.
+info: |
+ Intl.Collator.prototype.resolvedOptions ()
+
+ 7 Requirements for Standard Built-in ECMAScript Objects
+
+ 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 2018 Language
+ Specification, 9th edition, clause 17, or successor.
+
+ 17 ECMAScript Standard Built-in Objects:
+
+ 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]
+---*/
+
+verifyProperty(Intl.Collator.prototype, "resolvedOptions", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/shell.js b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/resolvedOptions/shell.js
@@ -0,0 +1,24 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/intl402/Collator/prototype/shell.js b/js/src/tests/test262/intl402/Collator/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/shell.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/this-value-collator-prototype.js b/js/src/tests/test262/intl402/Collator/prototype/this-value-collator-prototype.js
new file mode 100644
index 0000000000..0ccb9a5f52
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/this-value-collator-prototype.js
@@ -0,0 +1,16 @@
+// Copyright 2012 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-the-intl-collator-prototype-object
+description: >
+ Tests that Intl.Collator.prototype is not an object that has been
+ initialized as an Intl.Collator.
+---*/
+
+// test by calling a function that should fail as "this" is not an object
+// initialized as an Intl.Collator
+assert.throws(TypeError, () => Intl.Collator.prototype.compare("aаあ아", "aаあ아"),
+ "Intl.Collator.prototype is not an object that has been initialized as an Intl.Collator.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/this-value-not-collator.js b/js/src/tests/test262/intl402/Collator/prototype/this-value-not-collator.js
new file mode 100644
index 0000000000..dd75665f46
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/this-value-not-collator.js
@@ -0,0 +1,28 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.3_b
+description: >
+ Tests that Intl.Collator.prototype functions throw a TypeError if
+ called on a non-object value or an object that hasn't been
+ initialized as a Collator.
+author: Norbert Lindenberg
+---*/
+
+var functions = {
+ "compare getter": Object.getOwnPropertyDescriptor(Intl.Collator.prototype, "compare").get,
+ resolvedOptions: Intl.Collator.prototype.resolvedOptions
+};
+var invalidTargets = [undefined, null, true, 0, "Collator", [], {}];
+
+Object.getOwnPropertyNames(functions).forEach(function (functionName) {
+ var f = functions[functionName];
+ invalidTargets.forEach(function (target) {
+ assert.throws(TypeError, function() {
+ f.call(target);
+ }, "Calling " + functionName + " on " + target + " was not rejected.");
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/toStringTag/browser.js b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/browser.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/toStringTag/shell.js b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/shell.js
diff --git a/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-changed-tag.js b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-changed-tag.js
new file mode 100644
index 0000000000..84dcbda908
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-changed-tag.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype-@@tostringtag
+description: >
+ Object.prototype.toString utilizes Intl.Collator.prototype[@@toStringTag].
+info: |
+ Object.prototype.toString ( )
+
+ [...]
+ 14. Else, let builtinTag be "Object".
+ 15. Let tag be ? Get(O, @@toStringTag).
+ 16. If Type(tag) is not String, set tag to builtinTag.
+ 17. Return the string-concatenation of "[object ", tag, and "]".
+
+ Intl.Collator.prototype [ @@toStringTag ]
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+features: [Symbol.toStringTag]
+---*/
+
+Object.defineProperty(Intl.Collator.prototype, Symbol.toStringTag, {
+ value: "test262",
+});
+
+assert.sameValue(Object.prototype.toString.call(Intl.Collator.prototype), "[object test262]");
+assert.sameValue(Object.prototype.toString.call(new Intl.Collator()), "[object test262]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-removed-tag.js b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-removed-tag.js
new file mode 100644
index 0000000000..16074d110f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString-removed-tag.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype-@@tostringtag
+description: >
+ Object.prototype.toString doesn't special-case neither Intl.Collator instances nor its prototype.
+info: |
+ Object.prototype.toString ( )
+
+ [...]
+ 14. Else, let builtinTag be "Object".
+ 15. Let tag be ? Get(O, @@toStringTag).
+ 16. If Type(tag) is not String, set tag to builtinTag.
+ 17. Return the string-concatenation of "[object ", tag, and "]".
+features: [Symbol.toStringTag]
+---*/
+
+delete Intl.Collator.prototype[Symbol.toStringTag];
+
+assert.sameValue(Object.prototype.toString.call(Intl.Collator.prototype), "[object Object]");
+assert.sameValue(Object.prototype.toString.call(new Intl.Collator()), "[object Object]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString.js b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString.js
new file mode 100644
index 0000000000..ad6395fee9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toString.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype-@@tostringtag
+description: >
+ Object.prototype.toString utilizes Intl.Collator.prototype[@@toStringTag].
+info: |
+ Object.prototype.toString ( )
+
+ [...]
+ 14. Else, let builtinTag be "Object".
+ 15. Let tag be ? Get(O, @@toStringTag).
+ 16. If Type(tag) is not String, set tag to builtinTag.
+ 17. Return the string-concatenation of "[object ", tag, and "]".
+
+ Intl.Collator.prototype [ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the String value "Intl.Collator".
+features: [Symbol.toStringTag]
+---*/
+
+assert.sameValue(Object.prototype.toString.call(Intl.Collator.prototype), "[object Intl.Collator]");
+assert.sameValue(Object.prototype.toString.call(new Intl.Collator()), "[object Intl.Collator]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toStringTag.js b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toStringTag.js
new file mode 100644
index 0000000000..1f4942b46f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/prototype/toStringTag/toStringTag.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.collator.prototype-@@tostringtag
+description: >
+ Property descriptor of Intl.Collator.prototype[@@toStringTag].
+info: |
+ Intl.Collator.prototype [ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the String value "Intl.Collator".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+features: [Symbol.toStringTag]
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(Intl.Collator.prototype, Symbol.toStringTag, {
+ value: "Intl.Collator",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);