summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Locale/prototype/getCollations
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Locale/prototype/getCollations')
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array-values.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array.js18
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCollations/shell.js0
7 files changed, 127 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/branding.js
new file mode 100644
index 0000000000..c0f1038dc3
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/branding.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2023 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.getCollations
+description: Verifies the branding check for the "getCollations" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getCollations ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getCollations = Intl.Locale.prototype.getCollations;
+
+assert.sameValue(typeof getCollations, "function");
+
+assert.throws(TypeError, () => getCollations.call(undefined), "undefined");
+assert.throws(TypeError, () => getCollations.call(null), "null");
+assert.throws(TypeError, () => getCollations.call(true), "true");
+assert.throws(TypeError, () => getCollations.call(""), "empty string");
+assert.throws(TypeError, () => getCollations.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getCollations.call(1), "1");
+assert.throws(TypeError, () => getCollations.call({}), "plain object");
+assert.throws(TypeError, () => getCollations.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getCollations.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/name.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/name.js
new file mode 100644
index 0000000000..58cdc8538b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/name.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2023 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.getCollations
+description: Checks the "name" property of Intl.Locale.prototype.getCollations().
+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.Locale,Intl.Locale-info]
+---*/
+
+verifyProperty(Intl.Locale.prototype.getCollations, "name", {
+ value: "getCollations",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array-values.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array-values.js
new file mode 100644
index 0000000000..38abb00f09
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array-values.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.collations
+description: >
+ Checks that the return value of Intl.Locale.prototype.collations is an Array
+ that does not contain invalid values.
+info: |
+ CollationsOfLocale ( loc )
+ ...
+ 4. Let list be a List of 1 or more unique collation identifiers, which must
+ be lower case String values conforming to the type sequence from UTS 35
+ Unicode Locale Identifier, section 3.2, sorted in descending preference of
+ those in common use for string comparison in locale. The values "standard"
+ and "search" must be excluded from list.
+features: [Intl.Locale, Intl.Locale-info, Array.prototype.includes]
+---*/
+
+const output = new Intl.Locale('en').getCollations();
+assert(output.length > 0, 'array has at least one element');
+output.forEach(c => {
+ if(['standard', 'search'].includes(c))
+ throw new Test262Error();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array.js
new file mode 100644
index 0000000000..d4eb1e47ba
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/output-array.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.getCollations
+description: >
+ Checks that the return value of Intl.Locale.prototype.getCollations is an Array.
+info: |
+ CollationsOfLocale ( loc )
+ ...
+ 5. Return ! CreateArrayFromListAndPreferred( list, preferred ).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert(Array.isArray(new Intl.Locale('en').getCollations()));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/prop-desc.js
new file mode 100644
index 0000000000..fd48770432
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/prop-desc.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2023 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.getCollations
+description: Checks the "getCollations" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getCollations ()
+ 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.Locale,Intl.Locale-info]
+---*/
+
+assert.sameValue(
+ typeof Intl.Locale.prototype.getCollations,
+ "function",
+ "typeof Intl.Locale.prototype.getCollations is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getCollations", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCollations/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getCollations/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCollations/shell.js