summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek')
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/branding.js33
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/name.js25
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-id.js33
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-options.js54
7 files changed, 173 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/branding.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/branding.js
new file mode 100644
index 0000000000..5907a7c5e8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/branding.js
@@ -0,0 +1,33 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2023 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.firstDayOfWeek
+description: >
+ Verifies the branding check for the "firstDayOfWeek" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.firstDayOfWeek
+
+ 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then
+ a. Throw a TypeError exception.
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "firstDayOfWeek");
+const invalidValues = [
+ undefined,
+ null,
+ true,
+ "",
+ Symbol(),
+ 1,
+ {},
+ Intl.Locale.prototype,
+];
+
+for (const invalidValue of invalidValues) {
+ assert.throws(TypeError, () => propdesc.get.call(invalidValue));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/browser.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/name.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/name.js
new file mode 100644
index 0000000000..2f51b4b268
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/name.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2023 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.firstDayOfWeek
+description: >
+ Checks the "name" property of Intl.Locale.prototype.firstDayOfWeek.
+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. Functions that are specified as get or set accessor functions of built-in properties have "get " or "set " prepended to the property name string.
+ Unless otherwise specified, the name property of a built-in function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "firstDayOfWeek").get;
+verifyProperty(getter, "name", {
+ value: "get firstDayOfWeek",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/prop-desc.js
new file mode 100644
index 0000000000..9d1c8f2004
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/prop-desc.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2023 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "firstDayOfWeek" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.firstDayOfWeek
+
+ 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 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.
+includes: [propertyHelper.js]
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "firstDayOfWeek");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "firstDayOfWeek", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/shell.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-id.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-id.js
new file mode 100644
index 0000000000..2f723a409a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-id.js
@@ -0,0 +1,33 @@
+// |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
+description: >
+ Checks valid cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale.prototype.firstDayOfWeek
+ 3. Return loc.[[FirstDayOfWeek]].
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const validIds = [
+ ["en-u-fw-mon", 1],
+ ["en-u-fw-tue", 2],
+ ["en-u-fw-wed", 3],
+ ["en-u-fw-thu", 4],
+ ["en-u-fw-fri", 5],
+ ["en-u-fw-sat", 6],
+ ["en-u-fw-sun", 7],
+];
+for (const [id, expected] of validIds) {
+ assert.sameValue(
+ new Intl.Locale(id).firstDayOfWeek,
+ expected,
+ `new Intl.Locale(${id}).firstDayOfWeek returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-options.js b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-options.js
new file mode 100644
index 0000000000..00efebee33
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/firstDayOfWeek/valid-options.js
@@ -0,0 +1,54 @@
+// |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
+description: >
+ Checks valid cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale.prototype.firstDayOfWeek
+ 3. Return loc.[[FirstDayOfWeek]].
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const validFirstDayOfWeekOptions = [
+ ["mon", 1],
+ ["tue", 2],
+ ["wed", 3],
+ ["thu", 4],
+ ["fri", 5],
+ ["sat", 6],
+ ["sun", 7],
+ ["1", 1],
+ ["2", 2],
+ ["3", 3],
+ ["4", 4],
+ ["5", 5],
+ ["6", 6],
+ ["7", 7],
+ ["0", 7],
+ [1, 1],
+ [2, 2],
+ [3, 3],
+ [4, 4],
+ [5, 5],
+ [6, 6],
+ [7, 7],
+ [0, 7],
+];
+for (const [firstDayOfWeek, expected] of validFirstDayOfWeekOptions) {
+ assert.sameValue(
+ new Intl.Locale('en', { firstDayOfWeek }).firstDayOfWeek,
+ expected,
+ `new Intl.Locale("en", { firstDayOfWeek: ${firstDayOfWeek} }).firstDayOfWeek returns "${expected}"`
+ );
+ assert.sameValue(
+ new Intl.Locale('en-u-fw-WED', { firstDayOfWeek }).firstDayOfWeek,
+ expected,
+ `new Intl.Locale("en-u-fw-WED", { firstDayOfWeek: ${firstDayOfWeek} }).firstDayOfWeek returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);