summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Collator/supportedLocalesOf
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/supportedLocalesOf
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/supportedLocalesOf')
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/basic.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/builtin.js30
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/length.js34
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/name.js29
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/prop-desc.js33
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/shell.js24
-rw-r--r--js/src/tests/test262/intl402/Collator/supportedLocalesOf/taint-Object-prototype.js16
8 files changed, 190 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/basic.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/basic.js
new file mode 100644
index 0000000000..4ec8ea705a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/basic.js
@@ -0,0 +1,24 @@
+// Copyright 2012 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 10.2.2_a
+description: >
+ Tests that Intl.Collator has a supportedLocalesOf property, and
+ it works as planned.
+---*/
+
+var defaultLocale = new Intl.Collator().resolvedOptions().locale;
+var notSupported = 'zxx'; // "no linguistic content"
+var requestedLocales = [defaultLocale, notSupported];
+
+var supportedLocales;
+
+assert(Intl.Collator.hasOwnProperty('supportedLocalesOf'), "Intl.Collator doesn't have a supportedLocalesOf property.");
+
+supportedLocales = Intl.Collator.supportedLocalesOf(requestedLocales);
+assert.sameValue(supportedLocales.length, 1, 'The length of supported locales list is not 1.');
+
+assert.sameValue(supportedLocales[0], defaultLocale, 'The default locale is not returned in the supported list.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/browser.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/browser.js
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/builtin.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/builtin.js
new file mode 100644
index 0000000000..ab5f0f3e3f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/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.2.2_L15
+description: >
+ Tests that Intl.Collator.supportedLocalesOf 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.supportedLocalesOf), "[object Function]",
+ "The [[Class]] internal property of a built-in function must be " +
+ "\"Function\".");
+
+assert(Object.isExtensible(Intl.Collator.supportedLocalesOf),
+ "Built-in objects must be extensible.");
+
+assert.sameValue(Object.getPrototypeOf(Intl.Collator.supportedLocalesOf), Function.prototype);
+
+assert.sameValue(Intl.Collator.supportedLocalesOf.hasOwnProperty("prototype"), false,
+ "Built-in functions that aren't constructors must not have a prototype property.");
+
+assert.sameValue(isConstructor(Intl.Collator.supportedLocalesOf), false,
+ "Built-in functions don't implement [[Construct]] unless explicitly specified.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/length.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/length.js
new file mode 100644
index 0000000000..f61d6c706f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/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.supportedlocalesof
+description: >
+ Intl.Collator.supportedLocalesOf.length is 1.
+info: |
+ Intl.Collator.supportedLocalesOf ( locales [ , options ] )
+
+ 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.supportedLocalesOf, "length", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/name.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/name.js
new file mode 100644
index 0000000000..096f46d3c9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/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.supportedLocalesOf
+description: >
+ Intl.Collator.supportedLocalesOf.name is "supportedLocalesOf".
+info: |
+ 10.2.2 Intl.Collator.supportedLocalesOf (locales [ , options ])
+
+ 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.supportedLocalesOf, "name", {
+ value: "supportedLocalesOf",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/prop-desc.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/prop-desc.js
new file mode 100644
index 0000000000..3d31e5314d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/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.supportedlocalesof
+description: >
+ "supportedLocalesOf" property of Intl.Collator.
+info: |
+ Intl.Collator.supportedLocalesOf ( locales [ , options ] )
+
+ 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, "supportedLocalesOf", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Collator/supportedLocalesOf/shell.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/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/supportedLocalesOf/taint-Object-prototype.js b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/taint-Object-prototype.js
new file mode 100644
index 0000000000..7e3018883f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Collator/supportedLocalesOf/taint-Object-prototype.js
@@ -0,0 +1,16 @@
+// Copyright 2013 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+es5id: 10.2.2_b
+description: >
+ Tests that Intl.Collator.supportedLocalesOf doesn't access
+ arguments that it's not given.
+author: Norbert Lindenberg
+includes: [testIntl.js]
+---*/
+
+taintDataProperty(Object.prototype, "1");
+new Intl.Collator("und");
+
+reportCompare(0, 0);