summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Locale
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/Locale
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/Locale')
-rw-r--r--js/src/tests/test262/intl402/Locale/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/canonicalize-locale-list-take-locale.js55
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-apply-options-canonicalizes-twice.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-getter-order.js127
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-locale-object.js39
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-newtarget-undefined.js25
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-non-iana-canon.js112
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-calendar-invalid.js38
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-calendar-valid.js43
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-canonicalized.js71
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-casefirst-invalid.js39
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-casefirst-valid.js68
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-collation-invalid.js36
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-collation-valid.js64
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-invalid.js34
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-valid.js68
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-invalid.js45
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-valid.js74
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-language-grandfathered.js35
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-language-invalid.js71
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js45
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js68
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-invalid.js43
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-valid.js63
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-numeric-undefined.js56
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-numeric-valid.js70
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-region-invalid.js58
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-region-valid.js69
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-script-invalid.js54
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-script-valid-undefined.js50
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-script-valid.js64
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-throwing-getters.js35
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-parse-twice.js60
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-tag-tostring.js39
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-tag.js59
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-unicode-ext-invalid.js33
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js40
-rw-r--r--js/src/tests/test262/intl402/Locale/extensions-grandfathered.js69
-rw-r--r--js/src/tests/test262/intl402/Locale/extensions-private.js26
-rw-r--r--js/src/tests/test262/intl402/Locale/function-prototype.js18
-rw-r--r--js/src/tests/test262/intl402/Locale/getters-grandfathered.js41
-rw-r--r--js/src/tests/test262/intl402/Locale/getters-missing.js55
-rw-r--r--js/src/tests/test262/intl402/Locale/getters.js124
-rw-r--r--js/src/tests/test262/intl402/Locale/instance-extensibility.js22
-rw-r--r--js/src/tests/test262/intl402/Locale/instance.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/invalid-tag-throws-boolean.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/invalid-tag-throws-null.js21
-rw-r--r--js/src/tests/test262/intl402/Locale/invalid-tag-throws-number.js34
-rw-r--r--js/src/tests/test262/intl402/Locale/invalid-tag-throws-symbol.js21
-rw-r--r--js/src/tests/test262/intl402/Locale/invalid-tag-throws-undefined.js25
-rw-r--r--js/src/tests/test262/intl402/Locale/invalid-tag-throws.js41
-rw-r--r--js/src/tests/test262/intl402/Locale/length.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/likely-subtags-grandfathered.js200
-rw-r--r--js/src/tests/test262/intl402/Locale/likely-subtags.js115
-rw-r--r--js/src/tests/test262/intl402/Locale/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prop-desc.js35
-rw-r--r--js/src/tests/test262/intl402/Locale/proto-from-ctor-realm.js60
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/baseName/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/baseName/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/baseName/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/baseName/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/baseName/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/calendar/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/calendar/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/calendar/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/calendar/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/calendar/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/caseFirst/branding.js34
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/caseFirst/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/caseFirst/name.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/caseFirst/prop-desc.js29
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/caseFirst/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/collation/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/collation/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/collation/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/collation/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/collation/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/constructor/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/constructor/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/constructor/shell.js0
-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
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCalendars/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCalendars/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCalendars/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCalendars/output-array.js19
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCalendars/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getCalendars/shell.js0
-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
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array-values.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array.js18
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getHourCycles/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/output-array.js19
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object-keys.js34
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object.js18
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTextInfo/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-sorted.js25
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-undefined.js20
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array.js20
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getTimeZones/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/branding.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-id.js34
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-option.js55
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object-keys.js67
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object.js18
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/prop-desc.js28
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/hourCycle/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/hourCycle/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/hourCycle/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/hourCycle/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/hourCycle/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/language/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/language/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/language/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/language/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/language/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/maximize/branding.js35
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/maximize/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/maximize/length.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/maximize/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/maximize/prop-desc.js31
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/maximize/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/branding.js35
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/length.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/name.js23
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/prop-desc.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js51
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/minimize/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numberingSystem/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numberingSystem/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numberingSystem/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numberingSystem/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numberingSystem/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numeric/branding.js34
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numeric/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numeric/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numeric/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/numeric/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/prop-desc.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/region/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/region/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/region/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/region/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/region/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/script/branding.js32
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/script/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/script/name.js24
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/script/prop-desc.js27
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/script/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toString/branding.js35
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toString/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toString/prop-desc.js30
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toString/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toStringTag/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toStringTag/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString-removed-tag.js20
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString.js18
-rw-r--r--js/src/tests/test262/intl402/Locale/prototype/toStringTag/toStringTag.js25
-rw-r--r--js/src/tests/test262/intl402/Locale/reject-duplicate-variants-in-tlang.js52
-rw-r--r--js/src/tests/test262/intl402/Locale/reject-duplicate-variants.js46
-rw-r--r--js/src/tests/test262/intl402/Locale/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Locale/subclassing.js28
196 files changed, 5560 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Locale/browser.js b/js/src/tests/test262/intl402/Locale/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/canonicalize-locale-list-take-locale.js b/js/src/tests/test262/intl402/Locale/canonicalize-locale-list-take-locale.js
new file mode 100644
index 0000000000..1f20ba61fb
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/canonicalize-locale-list-take-locale.js
@@ -0,0 +1,55 @@
+// Copyright 2019 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies CanonicalizeLocaleList will take Intl.Locale as locales.
+info: |
+ CanonicalizeLocaleList ( locales )
+ 3. If Type(locales) is String or locales has an [[InitializedLocale]] internal slot, then
+ a. Let O be CreateArrayFromList(« locales »).
+
+ c. iii. If Type(kValue) is Object and kValue has an [[InitializedLocale]] internal slot, then
+ 1. Let tag be kValue.[[Locale]].
+ iv. Else,
+ 1. Let tag be ? ToString(kValue).
+features: [Intl.Locale]
+---*/
+
+const tag = "ar";
+const tag2 = "fa";
+const tag3 = "zh";
+const loc = new Intl.Locale(tag);
+
+// Monkey-patching Intl.Locale
+class PatchedLocale extends Intl.Locale {
+ constructor(tag, options) {
+ super(tag, options);
+ }
+ toString() {
+ // this should NOT get called.
+ assert(false, "toString should not be called")
+ }
+}
+const ploc = new PatchedLocale(tag2);
+
+// Test Intl.Locale as the only argument
+let res = Intl.getCanonicalLocales(loc);
+assert.sameValue(res.length, 1);
+assert.sameValue(res[0], tag);
+
+// Test Monkey-patched Intl.Locale as the only argument
+res = Intl.getCanonicalLocales(ploc);
+assert.sameValue(res.length, 1);
+assert.sameValue(res[0], tag2);
+
+// Test Intl.Locale and the Monkey-patched one are in
+// array.
+res = Intl.getCanonicalLocales([loc, tag3, ploc]);
+assert.sameValue(res.length, 3);
+assert.sameValue(res[0], tag);
+assert.sameValue(res[1], tag3);
+assert.sameValue(res[2], tag2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-apply-options-canonicalizes-twice.js b/js/src/tests/test262/intl402/Locale/constructor-apply-options-canonicalizes-twice.js
new file mode 100644
index 0000000000..e6d3f9a8b4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-apply-options-canonicalizes-twice.js
@@ -0,0 +1,28 @@
+// Copyright 2020 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-apply-options-to-tag
+description: >
+ ApplyOptionsToTag canonicalises the language tag two times.
+info: |
+ 10.1.1 ApplyOptionsToTag( tag, options )
+
+ ...
+ 9. Set tag to CanonicalizeUnicodeLocaleId(tag).
+ 10. If language is not undefined,
+ ...
+ b. Set tag to tag with the substring corresponding to the unicode_language_subtag
+ production of the unicode_language_id replaced by the string language.
+ ...
+ 13. Return CanonicalizeUnicodeLocaleId(tag).
+features: [Intl.Locale]
+---*/
+
+// ApplyOptionsToTag canonicalises the locale identifier before applying the
+// options. That means "und-Armn-SU" is first canonicalised to "und-Armn-AM",
+// then the language is changed to "ru". If "ru" were applied first, the result
+// would be "ru-Armn-RU" instead.
+assert.sameValue(new Intl.Locale("und-Armn-SU", {language: "ru"}).toString(), "ru-Armn-AM");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-getter-order.js b/js/src/tests/test262/intl402/Locale/constructor-getter-order.js
new file mode 100644
index 0000000000..4948f22480
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-getter-order.js
@@ -0,0 +1,127 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the order of evaluations of arguments and options for the Locale
+ constructor.
+features: [Intl.Locale]
+includes: [compareArray.js]
+---*/
+
+const order = [];
+new Intl.Locale(
+ { toString() { order.push("tag toString"); return "en"; } },
+ {
+ get language() {
+ order.push("get language");
+ return {
+ toString() {
+ order.push("toString language");
+ return "de";
+ }
+ }
+ },
+
+ get script() {
+ order.push("get script");
+ return {
+ toString() {
+ order.push("toString script");
+ return "Latn";
+ }
+ }
+ },
+
+ get region() {
+ order.push("get region");
+ return {
+ toString() {
+ order.push("toString region");
+ return "DE";
+ }
+ }
+ },
+
+ get calendar() {
+ order.push("get calendar");
+ return {
+ toString() {
+ order.push("toString calendar");
+ return "gregory";
+ }
+ }
+ },
+
+ get collation() {
+ order.push("get collation");
+ return {
+ toString() {
+ order.push("toString collation");
+ return "zhuyin";
+ }
+ }
+ },
+
+ get hourCycle() {
+ order.push("get hourCycle");
+ return {
+ toString() {
+ order.push("toString hourCycle");
+ return "h24";
+ }
+ }
+ },
+
+ get caseFirst() {
+ order.push("get caseFirst");
+ return {
+ toString() {
+ order.push("toString caseFirst");
+ return "upper";
+ }
+ }
+ },
+
+ get numeric() {
+ order.push("get numeric");
+ return false;
+ },
+
+ get numberingSystem() {
+ order.push("get numberingSystem");
+ return {
+ toString() {
+ order.push("toString numberingSystem");
+ return "latn";
+ }
+ }
+ },
+ }
+);
+
+const expected_order = [
+ "tag toString",
+ "get language",
+ "toString language",
+ "get script",
+ "toString script",
+ "get region",
+ "toString region",
+ "get calendar",
+ "toString calendar",
+ "get collation",
+ "toString collation",
+ "get hourCycle",
+ "toString hourCycle",
+ "get caseFirst",
+ "toString caseFirst",
+ "get numeric",
+ "get numberingSystem",
+ "toString numberingSystem"
+];
+
+assert.compareArray(order, expected_order);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-locale-object.js b/js/src/tests/test262/intl402/Locale/constructor-locale-object.js
new file mode 100644
index 0000000000..11760b13c8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-locale-object.js
@@ -0,0 +1,39 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization of specific tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ 10. Return CanonicalizeLanguageTag(tag).
+features: [Intl.Locale]
+---*/
+
+// Pass Intl.Locale object and replace subtag.
+const enUS = new Intl.Locale("en-US");
+const enGB = new Intl.Locale(enUS, {region: "GB"});
+
+assert.sameValue(enUS.toString(), "en-US", 'enUS.toString() returns "en-US"');
+assert.sameValue(enGB.toString(), "en-GB", 'enGB.toString() returns "en-GB"');
+
+// Pass Intl.Locale object and replace Unicode extension keyword.
+const zhUnihan = new Intl.Locale("zh-u-co-unihan");
+const zhZhuyin = new Intl.Locale(zhUnihan, {collation: "zhuyin"});
+
+assert.sameValue(
+ zhUnihan.toString(),
+ "zh-u-co-unihan",
+ 'zhUnihan.toString() returns "zh-u-co-unihan"'
+);
+assert.sameValue(
+ zhZhuyin.toString(),
+ "zh-u-co-zhuyin",
+ 'zhZhuyin.toString() returns "zh-u-co-zhuyin"'
+);
+
+assert.sameValue(zhUnihan.collation, "unihan", 'The value of zhUnihan.collation is "unihan"');
+assert.sameValue(zhZhuyin.collation, "zhuyin", 'The value of zhZhuyin.collation is "zhuyin"');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-newtarget-undefined.js b/js/src/tests/test262/intl402/Locale/constructor-newtarget-undefined.js
new file mode 100644
index 0000000000..c63fc1c044
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-newtarget-undefined.js
@@ -0,0 +1,25 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the NewTarget check for Intl.Locale.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+assert.throws(TypeError, function() {
+ Intl.Locale();
+}, 'Intl.Locale() throws TypeError');
+
+assert.throws(TypeError, function() {
+ Intl.Locale("en");
+}, 'Intl.Locale("en") throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-non-iana-canon.js b/js/src/tests/test262/intl402/Locale/constructor-non-iana-canon.js
new file mode 100644
index 0000000000..14191e3014
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-non-iana-canon.js
@@ -0,0 +1,112 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization, minimization and maximization of specific tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ 10. Return CanonicalizeLanguageTag(tag).
+
+ Intl.Locale.prototype.maximize ()
+ 3. Let maximal be the result of the Add Likely Subtags algorithm applied to loc.[[Locale]].
+
+ Intl.Locale.prototype.minimize ()
+ 3. Let minimal be the result of the Remove Likely Subtags algorithm applied to loc.[[Locale]].
+features: [Intl.Locale]
+---*/
+
+// Test some language tags where we know that either CLDR or ICU produce
+// different results compared to the canonicalization specified in RFC 5646.
+var testData = [
+ {
+ tag: "mo",
+ canonical: "ro",
+ maximized: "ro-Latn-RO",
+ },
+ {
+ tag: "es-ES-preeuro",
+ maximized: "es-Latn-ES-preeuro",
+ minimized: "es-preeuro",
+ },
+ {
+ tag: "uz-UZ-cyrillic",
+ maximized: "uz-Latn-UZ-cyrillic",
+ minimized: "uz-cyrillic",
+ },
+ {
+ tag: "posix",
+ },
+ {
+ tag: "hi-direct",
+ maximized: "hi-Deva-IN-direct",
+ },
+ {
+ tag: "zh-pinyin",
+ maximized: "zh-Hans-CN-pinyin",
+ },
+ {
+ tag: "zh-stroke",
+ maximized: "zh-Hans-CN-stroke",
+ },
+ {
+ tag: "aar-x-private",
+ // "aar" should be canonicalized into "aa" because "aar" matches the type attribute of
+ // a languageAlias element in
+ // https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
+ canonical: "aa-x-private",
+ maximized: "aa-Latn-ET-x-private",
+ },
+ {
+ tag: "heb-x-private",
+ // "heb" should be canonicalized into "he" because "heb" matches the type attribute of
+ // a languageAlias element in
+ // https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
+ canonical: "he-x-private",
+ maximized: "he-Hebr-IL-x-private",
+ },
+ {
+ tag: "de-u-kf",
+ maximized: "de-Latn-DE-u-kf",
+ },
+ {
+ tag: "ces",
+ // "ces" should be canonicalized into "cs" because "ces" matches the type attribute of
+ // a languageAlias element in
+ // https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
+ canonical: "cs",
+ maximized: "cs-Latn-CZ",
+ },
+ {
+ tag: "hy-arevela",
+ canonical: "hy",
+ maximized: "hy-Armn-AM",
+ },
+ {
+ tag: "hy-arevmda",
+ canonical: "hyw",
+ maximized: "hyw-Armn-AM",
+ },
+];
+
+for (const {tag, canonical = tag, maximized = canonical, minimized = canonical} of testData) {
+ const loc = new Intl.Locale(tag);
+ assert.sameValue(
+ new Intl.Locale(tag).toString(),
+ canonical,
+ `new Intl.Locale("${tag}").toString() returns "${canonical}"`
+ );
+ assert.sameValue(
+ new Intl.Locale(tag).maximize().toString(),
+ maximized,
+ `new Intl.Locale("${tag}").maximize().toString() returns "${maximized}"`
+ );
+ assert.sameValue(
+ new Intl.Locale(tag).minimize().toString(),
+ minimized,
+ `new Intl.Locale("${tag}").minimize().toString() returns "${minimized}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-calendar-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-calendar-invalid.js
new file mode 100644
index 0000000000..0ac2861b99
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-calendar-invalid.js
@@ -0,0 +1,38 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 15. If calendar is not undefined, then
+ a. If calendar does not match the [(3*8alphanum) *("-" (3*8alphanum))] sequence, throw a RangeError exception.
+ 16. Set opt.[[ca]] to calendar.
+
+features: [Intl.Locale]
+---*/
+
+
+/*
+ alphanum = (ALPHA / DIGIT) ; letters and numbers
+ calendar = (3*8alphanum) *("-" (3*8alphanum))
+*/
+const invalidCalendarOptions = [
+ "",
+ "a",
+ "ab",
+ "abcdefghi",
+ "abc-abcdefghi",
+];
+for (const calendar of invalidCalendarOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {calendar});
+ }, `new Intl.Locale("en", {calendar: "${calendar}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-calendar-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-calendar-valid.js
new file mode 100644
index 0000000000..4a1049bf7a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-calendar-valid.js
@@ -0,0 +1,43 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 14. Let calendar be ? GetOption(options, "calendar", "string", undefined, undefined).
+ ...
+
+features: [Intl.Locale]
+---*/
+
+const validCalendarOptions = [
+ ["abc", "en-u-ca-abc"],
+ ["abcd", "en-u-ca-abcd"],
+ ["abcde", "en-u-ca-abcde"],
+ ["abcdef", "en-u-ca-abcdef"],
+ ["abcdefg", "en-u-ca-abcdefg"],
+ ["abcdefgh", "en-u-ca-abcdefgh"],
+ ["12345678", "en-u-ca-12345678"],
+ ["1234abcd", "en-u-ca-1234abcd"],
+ ["1234abcd-abc123", "en-u-ca-1234abcd-abc123"],
+];
+for (const [calendar, expected] of validCalendarOptions) {
+ assert.sameValue(
+ new Intl.Locale('en', { calendar }).toString(),
+ expected,
+ `new Intl.Locale('en', { calendar: "${calendar}" }).toString() returns "${expected}"`
+ );
+ assert.sameValue(
+ new Intl.Locale('en-u-ca-gregory', { calendar }).toString(),
+ expected,
+ `new Intl.Locale('en-u-ca-gregory', { calendar: "${calendar}" }).toString() returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-canonicalized.js b/js/src/tests/test262/intl402/Locale/constructor-options-canonicalized.js
new file mode 100644
index 0000000000..6019635f15
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-canonicalized.js
@@ -0,0 +1,71 @@
+// Copyright 2020 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-resolvelocale
+description: >
+ Values provided as properties of the options-argument to the Locale
+ constructor are converted to canonical form.
+info: |
+ ResolveLocale ( availableLocales, requestedLocales, options, relevantExtensionKeys, localeData )
+
+ ...
+ 9.i.iii.1. Let optionsValue be the string optionsValue after performing the algorithm steps to transform Unicode extension values to canonical syntax per Unicode Technical Standard #35 LDML § 3.2.1 Canonical Unicode Locale Identifiers, treating key as ukey and optionsValue as uvalue productions.
+ 9.i.iii.2. Let optionsValue be the string optionsValue after performing the algorithm steps to replace Unicode extension values with their canonical form per Unicode Technical Standard #35 LDML § 3.2.1 Canonical Unicode Locale Identifiers, treating key as ukey and optionsValue as uvalue productions.
+ ...
+
+features: [Intl.Locale]
+---*/
+
+const keyValueTests = [
+ {
+ key: "ca",
+ option: "calendar",
+ tests: [
+ ["islamicc", "islamic-civil"],
+ ["ethiopic-amete-alem", "ethioaa"],
+ ],
+ },
+];
+
+for (const { key, option, tests } of keyValueTests) {
+ for (const [noncanonical, canonical] of tests) {
+ let canonicalInLocale =
+ new Intl.Locale(`en-u-${key}-${canonical}`);
+
+ assert.sameValue(
+ canonicalInLocale[option],
+ canonical,
+ `new Intl.Locale("en-u-${key}-${canonical}").${option} returns ${canonical}`
+ );
+
+ let canonicalInOption =
+ new Intl.Locale(`en`, { [option]: canonical });
+
+ assert.sameValue(
+ canonicalInOption[option],
+ canonical,
+ `new Intl.Locale("en", { ${option}: "${canonical}" }).${option} returns ${canonical}`
+ );
+
+ let noncanonicalInLocale =
+ new Intl.Locale(`en-u-${key}-${noncanonical}`);
+
+ assert.sameValue(
+ noncanonicalInLocale[option],
+ canonical,
+ `new Intl.Locale("en-u-${key}-${noncanonical}").${option} returns ${canonical}`
+ );
+
+ let noncanonicalInOption =
+ new Intl.Locale(`en`, { [option]: noncanonical });
+
+ assert.sameValue(
+ noncanonicalInOption[option],
+ canonical,
+ `new Intl.Locale("en", { ${option}: "${noncanonical}" }).${option} returns ${canonical}`
+ );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-casefirst-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-casefirst-invalid.js
new file mode 100644
index 0000000000..e15c14c45c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-casefirst-invalid.js
@@ -0,0 +1,39 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 22. Let kf be ? GetOption(options, "caseFirst", "string", « "upper", "lower", "false" », undefined).
+ ...
+
+ GetOption ( options, property, type, values, fallback )
+ ...
+ 2. d. If values is not undefined, then
+ i. If values does not contain an element equal to value, throw a RangeError exception.
+ ...
+features: [Intl.Locale]
+---*/
+
+
+const invalidCaseFirstOptions = [
+ "",
+ "u",
+ "Upper",
+ "upper\0",
+ "uppercase",
+ "true",
+ { valueOf() { return false; } },
+];
+for (const caseFirst of invalidCaseFirstOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {caseFirst});
+ }, `new Intl.Locale("en", {caseFirst: "${caseFirst}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-casefirst-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-casefirst-valid.js
new file mode 100644
index 0000000000..fc5b837c64
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-casefirst-valid.js
@@ -0,0 +1,68 @@
+// Copyright 2018 Igalia, S.L. 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( tag [, options] )
+
+ ...
+ 22. Let kf be ? GetOption(options, "caseFirst", "string", « "upper", "lower", "false" », undefined).
+ 23. Set opt.[[kf]] to kf.
+ ...
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+
+ ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
+
+ ...
+ 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed.
+ 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords).
+ 10. If newExtension is not the empty String, then
+ a. Let locale be ! InsertUnicodeExtension(locale, newExtension).
+ ...
+
+ CanonicalizeUnicodeExtension( attributes, keywords )
+ ...
+ 4. Repeat for each element entry of keywords in List order,
+ a. Let keyword be entry.[[Key]].
+ b. If entry.[[Value]] is not the empty String, then
+ i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]].
+ c. Append keyword to fullKeywords.
+ ...
+features: [Intl.Locale]
+---*/
+
+const validCaseFirstOptions = [
+ "upper",
+ "lower",
+ "false",
+ false,
+ { toString() { return false; } },
+];
+for (const caseFirst of validCaseFirstOptions) {
+ const expected = String(caseFirst);
+ let expect = "en-u-kf-" + expected;
+ assert.sameValue(
+ new Intl.Locale('en', { caseFirst }).toString(),
+ expect,
+ `new Intl.Locale("en", { caseFirst: "${caseFirst}" }).toString() returns "${expect}"`
+ );
+
+ expect = "en-u-kf-" + expected;
+ assert.sameValue(
+ new Intl.Locale('en-u-kf-lower', { caseFirst }).toString(),
+ expect,
+ `new Intl.Locale("en-u-kf-lower", { caseFirst: "${caseFirst}" }).toString() returns "${expect}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-kf-lower', { caseFirst }).caseFirst,
+ expected,
+ `new Intl.Locale("en-u-kf-lower", { caseFirst }).caseFirst equals "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-collation-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-collation-invalid.js
new file mode 100644
index 0000000000..d256093257
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-collation-invalid.js
@@ -0,0 +1,36 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 18. If collation is not undefined, then
+ a. If collation does not match the [(3*8alphanum) *("-" (3*8alphanum))] sequence, throw a RangeError exception.
+
+features: [Intl.Locale]
+---*/
+
+
+/*
+ alphanum = (ALPHA / DIGIT) ; letters and numbers
+ collation = (3*8alphanum) *("-" (3*8alphanum))
+*/
+const invalidCollationOptions = [
+ "",
+ "a",
+ "ab",
+ "abcdefghi",
+ "abc-abcdefghi",
+];
+for (const invalidCollationOption of invalidCollationOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {collation: invalidCollationOption});
+ }, '`new Intl.Locale("en", {collation: invalidCollationOption})` throws RangeError');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-collation-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-collation-valid.js
new file mode 100644
index 0000000000..e9bf3077a2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-collation-valid.js
@@ -0,0 +1,64 @@
+// Copyright 2018 Igalia, S.L. 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( tag [, options] )
+
+ ...
+ 17. Let collation be ? GetOption(options, "collation", "string", undefined, undefined).
+ ...
+ 19. Set opt.[[co]] to collation.
+ ...
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+
+ ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
+
+ ...
+ 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed.
+ 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords).
+ 10. If newExtension is not the empty String, then
+ a. Let locale be ! InsertUnicodeExtension(locale, newExtension).
+ ...
+
+ CanonicalizeUnicodeExtension( attributes, keywords )
+ ...
+ 4. Repeat for each element entry of keywords in List order,
+ a. Let keyword be entry.[[Key]].
+ b. If entry.[[Value]] is not the empty String, then
+ i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]].
+ c. Append keyword to fullKeywords.
+ ...
+features: [Intl.Locale]
+---*/
+
+const validCollationOptions = [
+ ["abc", "en-u-co-abc"],
+ ["abcd", "en-u-co-abcd"],
+ ["abcde", "en-u-co-abcde"],
+ ["abcdef", "en-u-co-abcdef"],
+ ["abcdefg", "en-u-co-abcdefg"],
+ ["abcdefgh", "en-u-co-abcdefgh"],
+ ["12345678", "en-u-co-12345678"],
+ ["1234abcd", "en-u-co-1234abcd"],
+ ["1234abcd-abc123", "en-u-co-1234abcd-abc123"],
+];
+for (const [collation, expected] of validCollationOptions) {
+ assert.sameValue(
+ new Intl.Locale('en', {collation}).toString(),
+ expected,
+ `new Intl.Locale('en', {collation: "${collation}"}).toString() returns "${expected}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-co-gregory', {collation}).toString(),
+ expected,
+ `new Intl.Locale('en-u-co-gregory', {collation: "${collation}"}).toString() returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-invalid.js
new file mode 100644
index 0000000000..5d03d0755c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-invalid.js
@@ -0,0 +1,34 @@
+// |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 error cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ x. Let numberingSystem be ? GetOption(options, "firstDayOfWeek", "string", < *"mon"*, *"tue"*, *"wed"*, *"thu"*, *"fri"*, *"sat"*, *"sun"*, *"0"*, *"1"*, *"2"*, *"3"*, *"4"*, *"5"*, *"6"*, *"7"*> , undefined).
+ ...
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const invalidFirstDayOfWeekOptions = [
+ "",
+ "m",
+ "mo",
+ "monday",
+ true,
+ false,
+ null,
+];
+for (const firstDayOfWeek of invalidFirstDayOfWeekOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale('en', {firstDayOfWeek});
+ }, `new Intl.Locale("en", {firstDayOfWeek: "${firstDayOfWeek}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-valid.js
new file mode 100644
index 0000000000..0c5a84cc3a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-firstDayOfWeek-valid.js
@@ -0,0 +1,68 @@
+// |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( tag [, options] )
+
+ ...
+ x. Let numberingSystem be ? GetOption(options, "firstDayOfWeek", "string", < *"mon"*, *"tue"*, *"wed"*, *"thu"*, *"fri"*, *"sat"*, *"sun"*, *"0"*, *"1"*, *"2"*, *"3"*, *"4"*, *"5"*, *"6"*, *"7"*> , undefined).
+ x. Let firstDay be *undefined*.
+ x. If fw is not *undefined*, then
+ x. Set firstDay to !WeekdayToString(fw).
+ x. Set opt.[[fw]] to firstDay.
+ ...
+ x. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+ x. Let firstDay be *undefined*.
+ x. If r.[[fw]] is not *undefined*, then
+ x. Set firstDay to ! WeekdayToNumber(r.[[fw]]).
+ x. Set locale.[[FirstDayOfWeek]] to firstDay.
+ ...
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const validFirstDayOfWeekOptions = [
+ ["mon", "en-u-fw-mon"],
+ ["tue", "en-u-fw-tue"],
+ ["wed", "en-u-fw-wed"],
+ ["thu", "en-u-fw-thu"],
+ ["fri", "en-u-fw-fri"],
+ ["sat", "en-u-fw-sat"],
+ ["sun", "en-u-fw-sun"],
+ ["1", "en-u-fw-mon"],
+ ["2", "en-u-fw-tue"],
+ ["3", "en-u-fw-wed"],
+ ["4", "en-u-fw-thu"],
+ ["5", "en-u-fw-fri"],
+ ["6", "en-u-fw-sat"],
+ ["7", "en-u-fw-sun"],
+ ["0", "en-u-fw-sun"],
+ [1, "en-u-fw-mon"],
+ [2, "en-u-fw-tue"],
+ [3, "en-u-fw-wed"],
+ [4, "en-u-fw-thu"],
+ [5, "en-u-fw-fri"],
+ [6, "en-u-fw-sat"],
+ [7, "en-u-fw-sun"],
+ [0, "en-u-fw-sun"],
+];
+for (const [firstDayOfWeek, expected] of validFirstDayOfWeekOptions) {
+ assert.sameValue(
+ new Intl.Locale('en', { firstDayOfWeek }).toString(),
+ expected,
+ `new Intl.Locale("en", { firstDayOfWeek: ${firstDayOfWeek} }).toString() returns "${expected}"`
+ );
+ assert.sameValue(
+ new Intl.Locale('en-u-fw-WED', { firstDayOfWeek }).toString(),
+ expected,
+ `new Intl.Locale("en-u-fw-WED", { firstDayOfWeek: ${firstDayOfWeek} }).toString() returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-invalid.js
new file mode 100644
index 0000000000..a266bbb7b1
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-invalid.js
@@ -0,0 +1,45 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 20. Let hc be ? GetOption(options, "hourCycle", "string", « "h11", "h12", "h23", "h24" », undefined).
+ ...
+
+ GetOption ( options, property, type, values, fallback )
+ ...
+ 2. d. If values is not undefined, then
+ i. If values does not contain an element equal to value, throw a RangeError exception.
+ ...
+features: [Intl.Locale]
+---*/
+
+
+const invalidHourCycleOptions = [
+ "",
+ "h",
+ "h00",
+ "h01",
+ "h10",
+ "h13",
+ "h22",
+ "h25",
+ "h48",
+ "h012",
+ "h120",
+ "h12\0",
+ "H12",
+];
+for (const hourCycle of invalidHourCycleOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {hourCycle});
+ }, `new Intl.Locale("en", {hourCycle: "${hourCycle}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-valid.js
new file mode 100644
index 0000000000..f314ce23ff
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-hourcycle-valid.js
@@ -0,0 +1,74 @@
+// Copyright 2018 Igalia, S.L. 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( tag [, options] )
+
+ ...
+ 20. Let hc be ? GetOption(options, "hourCycle", "string", « "h11", "h12", "h23", "h24" », undefined).
+ 21. Set opt.[[hc]] to hc.
+ ...
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+
+ ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
+
+ ...
+ 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed.
+ 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords).
+ 10. If newExtension is not the empty String, then
+ a. Let locale be ! InsertUnicodeExtension(locale, newExtension).
+ ...
+
+ CanonicalizeUnicodeExtension( attributes, keywords )
+ ...
+ 4. Repeat for each element entry of keywords in List order,
+ a. Let keyword be entry.[[Key]].
+ b. If entry.[[Value]] is not the empty String, then
+ i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]].
+ c. Append keyword to fullKeywords.
+ ...
+features: [Intl.Locale]
+---*/
+
+const validHourCycleOptions = [
+ 'h11',
+ 'h12',
+ 'h23',
+ 'h24',
+ { toString() { return 'h24'; } },
+];
+for (const hourCycle of validHourCycleOptions) {
+ const expected = String(hourCycle);
+ let expect = 'en-u-hc-' + expected;
+
+ assert.sameValue(
+ new Intl.Locale('en', {hourCycle}).toString(),
+ expect,
+ `new Intl.Locale("en", {hourCycle: "${hourCycle}"}).toString() returns "${expect}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-hc-h00', {hourCycle}).toString(),
+ expect,
+ `new Intl.Locale("en-u-hc-h00", {hourCycle: "${hourCycle}"}).toString() returns "${expect}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-hc-h12', {hourCycle}).toString(),
+ expect,
+ `new Intl.Locale("en-u-hc-h12", {hourCycle: "${hourCycle}"}).toString() returns "${expect}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-hc-h00', {hourCycle}).hourCycle,
+ expected,
+ `new Intl.Locale("en-u-hc-h00", {hourCycle: "${hourCycle}"}).hourCycle equals "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-language-grandfathered.js b/js/src/tests/test262/intl402/Locale/constructor-options-language-grandfathered.js
new file mode 100644
index 0000000000..0d73349aa2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-language-grandfathered.js
@@ -0,0 +1,35 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ ApplyOptionsToTag( tag, options )
+ ...
+ 3. Let language be ? GetOption(options, "language", "string", undefined, undefined).
+ 4. If language is not undefined, then
+ a. If language does not match the language production, throw a RangeError exception.
+ b. If language matches the grandfathered production, throw a RangeError exception.
+ ...
+
+features: [Intl.Locale]
+---*/
+
+assert.throws(RangeError, function() {
+ new Intl.Locale("nb", {
+ language: "no-bok",
+ });
+}, `new Intl.Locale("nb", {language: "no-bok"}) throws RangeError`);
+
+assert.throws(RangeError, function() {
+ new Intl.Locale("nb", {
+ language: "no-bok",
+ region: "NO",
+ });
+}, `new Intl.Locale("nb", {language: "no-bok", region: "NO"}) throws RangeError`);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-language-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-language-invalid.js
new file mode 100644
index 0000000000..512cf1d67e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-language-invalid.js
@@ -0,0 +1,71 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 4. If language is not undefined, then
+ a. If language does not match the language production, throw a RangeError exception.
+ ...
+
+features: [Intl.Locale]
+---*/
+
+/*
+ language = 2*3ALPHA ; shortest ISO 639 code
+ ["-" extlang] ; sometimes followed by
+ ; extended language subtags
+ / 4ALPHA ; or reserved for future use
+ / 5*8ALPHA ; or registered language subtag
+
+ extlang = 3ALPHA ; selected ISO 639 codes
+ *2("-" 3ALPHA) ; permanently reserved
+*/
+const invalidLanguageOptions = [
+ "",
+ "a",
+ "ab7",
+ "notalanguage",
+ "undefined",
+
+ // Value contains more than just the 'language' production.
+ "fr-Latn",
+ "fr-FR",
+ "sa-vaidika",
+ "fr-a-asdf",
+ "fr-x-private",
+
+ // Irregular grandfathered language tag.
+ "i-klingon",
+
+ // Regular grandfathered language tag.
+ "zh-min",
+ "zh-min-nan",
+
+ // Reserved with extended language subtag
+ "abcd-US",
+ "abcde-US",
+ "abcdef-US",
+ "abcdefg-US",
+ "abcdefgh-US",
+
+ 7,
+];
+for (const language of invalidLanguageOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {language});
+ }, `new Intl.Locale("en", {language: "${language}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js
new file mode 100644
index 0000000000..c1ef7ef355
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js
@@ -0,0 +1,45 @@
+// Copyright 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verify valid language option values (undefined)
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+ ...
+
+ IsStructurallyValidLanguageTag ( locale )
+
+ The IsStructurallyValidLanguageTag abstract operation verifies that the
+ locale argument (which must be a String value)
+
+ represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+ Unicode Technical Standard 35 section 3.2, or successor,
+
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(
+ new Intl.Locale('en', {language: undefined}).toString(),
+ 'en',
+ `new Intl.Locale('en', {language: undefined}).toString() returns "en"`
+);
+
+assert.sameValue(
+ new Intl.Locale('en-US', {language: undefined}).toString(),
+ 'en-US',
+ `new Intl.Locale('en-US', {language: undefined}).toString() returns "en-US"`
+);
+
+assert.throws(RangeError, () => new Intl.Locale('en-els', {language: undefined}));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js
new file mode 100644
index 0000000000..0f1f0b1e32
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js
@@ -0,0 +1,68 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verify valid language option values (various)
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+ 3. Let language be ? GetOption(options, "language", "string", undefined, undefined).
+ 4. If language is not undefined, then
+ a. If language does not match the unicode_language_subtag production, throw a RangeError exception.
+
+ IsStructurallyValidLanguageTag ( locale )
+
+ The IsStructurallyValidLanguageTag abstract operation verifies that the
+ locale argument (which must be a String value)
+
+ represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+ Unicode Technical Standard 35 section 3.2, or successor,
+
+features: [Intl.Locale]
+---*/
+
+const validLanguageOptions = [
+ [{ toString() { return 'de' } }, 'de'],
+];
+for (const [language, expected] of validLanguageOptions) {
+ let expect = expected || 'en';
+
+ assert.sameValue(
+ new Intl.Locale('en', {language}).toString(),
+ expect,
+ `new Intl.Locale('en', {language: "${language}"}).toString() returns "${expect}"`
+ );
+
+ expect = (expected || 'en') + '-US';
+ assert.sameValue(
+ new Intl.Locale('en-US', {language}).toString(),
+ expect,
+ `new Intl.Locale('en-US', {language: "${language}"}).toString() returns "${expect}"`
+ );
+
+ assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
+
+}
+
+const invalidLanguageOptions = [
+ null,
+ 'zh-cmn',
+ 'ZH-CMN',
+ 'abcd',
+];
+for (const language of invalidLanguageOptions) {
+ assert.throws(RangeError, () => new Intl.Locale('en', {language}));
+ assert.throws(RangeError, () => new Intl.Locale('en-US', {language}));
+ assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-invalid.js
new file mode 100644
index 0000000000..e3e147447d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-invalid.js
@@ -0,0 +1,43 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 28. If numberingSystem is not undefined, then
+ a. If numberingSystem does not match the [(3*8alphanum) *("-" (3*8alphanum))] sequence, throw a RangeError exception.
+
+features: [Intl.Locale]
+---*/
+
+
+/*
+ alphanum = (ALPHA / DIGIT) ; letters and numbers
+ numberingSystem = (3*8alphanum) *("-" (3*8alphanum))
+*/
+const invalidNumberingSystemOptions = [
+ "",
+ "a",
+ "ab",
+ "abcdefghi",
+ "abc-abcdefghi",
+ "!invalid!",
+ "-latn-",
+ "latn-",
+ "latn--",
+ "latn-ca",
+ "latn-ca-",
+ "latn-ca-gregory",
+];
+for (const numberingSystem of invalidNumberingSystemOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale('en', {numberingSystem});
+ }, `new Intl.Locale("en", {numberingSystem: "${numberingSystem}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-valid.js
new file mode 100644
index 0000000000..6b9cef0c29
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-numberingsystem-valid.js
@@ -0,0 +1,63 @@
+// Copyright 2018 Igalia, S.L. 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( tag [, options] )
+
+ ...
+ 27. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined).
+ ...
+ 29. Set opt.[[nu]] to numberingSystem.
+ ...
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+
+ ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
+
+ ...
+ 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed.
+ 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords).
+ 10. If newExtension is not the empty String, then
+ a. Let locale be ! InsertUnicodeExtension(locale, newExtension).
+ ...
+
+ CanonicalizeUnicodeExtension( attributes, keywords )
+ ...
+ 4. Repeat for each element entry of keywords in List order,
+ a. Let keyword be entry.[[Key]].
+ b. If entry.[[Value]] is not the empty String, then
+ i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]].
+ c. Append keyword to fullKeywords.
+ ...
+features: [Intl.Locale]
+---*/
+
+const validNumberingSystemOptions = [
+ ["abc", "en-u-nu-abc"],
+ ["abcd", "en-u-nu-abcd"],
+ ["abcde", "en-u-nu-abcde"],
+ ["abcdef", "en-u-nu-abcdef"],
+ ["abcdefg", "en-u-nu-abcdefg"],
+ ["abcdefgh", "en-u-nu-abcdefgh"],
+ ["12345678", "en-u-nu-12345678"],
+ ["1234abcd", "en-u-nu-1234abcd"],
+ ["1234abcd-abc123", "en-u-nu-1234abcd-abc123"],
+];
+for (const [numberingSystem, expected] of validNumberingSystemOptions) {
+ assert.sameValue(
+ new Intl.Locale('en', { numberingSystem }).toString(),
+ expected,
+ `new Intl.Locale("en", { numberingSystem: ${numberingSystem} }).toString() returns "${expected}"`
+ );
+ assert.sameValue(
+ new Intl.Locale('en-u-nu-latn', { numberingSystem }).toString(),
+ expected,
+ `new Intl.Locale("en-u-nu-latn", { numberingSystem: ${numberingSystem} }).toString() returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-numeric-undefined.js b/js/src/tests/test262/intl402/Locale/constructor-options-numeric-undefined.js
new file mode 100644
index 0000000000..d51f2513e4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-numeric-undefined.js
@@ -0,0 +1,56 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: Verifies the behavior of an undefined numeric option to the Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 24. Let kn be ? GetOption(options, "numeric", "boolean", undefined, undefined).
+ 25. If kn is not undefined, set kn to ! ToString(kn).
+ ...
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+
+ ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
+
+ ...
+ 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed.
+ 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords).
+ 10. If newExtension is not the empty String, then
+ a. Let locale be ! InsertUnicodeExtension(locale, newExtension).
+ ...
+
+ CanonicalizeUnicodeExtension( attributes, keywords )
+ ...
+ 4. Repeat for each element entry of keywords in List order,
+ a. Let keyword be entry.[[Key]].
+ b. If entry.[[Value]] is not the empty String, then
+ i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]].
+ c. Append keyword to fullKeywords.
+ ...
+features: [Intl.Locale]
+---*/
+
+const options = { numeric: undefined };
+assert.sameValue(
+ new Intl.Locale('en', options).toString(),
+ "en",
+ 'new Intl.Locale("en", {numeric: undefined}).toString() returns "en"'
+);
+
+assert.sameValue(
+ new Intl.Locale('en-u-kn-true', options).toString(),
+ "en-u-kn",
+ 'new Intl.Locale("en-u-kn-true", {numeric: undefined}).toString() returns "en-u-kn"'
+);
+
+assert.sameValue(
+ new Intl.Locale('en-u-kf-lower', options).numeric,
+ false,
+ 'The value of new Intl.Locale("en-u-kf-lower", {numeric: undefined}).numeric equals `false`'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-numeric-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-numeric-valid.js
new file mode 100644
index 0000000000..eaa1351961
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-numeric-valid.js
@@ -0,0 +1,70 @@
+// Copyright 2018 Igalia, S.L. 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( tag [, options] )
+
+ ...
+ 24. Let kn be ? GetOption(options, "numeric", "boolean", undefined, undefined).
+ 25. If kn is not undefined, set kn to ! ToString(kn).
+ ...
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+ ...
+
+ ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
+
+ ...
+ 8. Let locale be the String value that is tag with all Unicode locale extension sequences removed.
+ 9. Let newExtension be ! CanonicalizeUnicodeExtension(attributes, keywords).
+ 10. If newExtension is not the empty String, then
+ a. Let locale be ! InsertUnicodeExtension(locale, newExtension).
+ ...
+
+ CanonicalizeUnicodeExtension( attributes, keywords )
+ ...
+ 4. Repeat for each element entry of keywords in List order,
+ a. Let keyword be entry.[[Key]].
+ b. If entry.[[Value]] is not the empty String, then
+ i. Let keyword be the string-concatenation of keyword, "-", and entry.[[Value]].
+ c. Append keyword to fullKeywords.
+ ...
+features: [Intl.Locale]
+---*/
+
+const validNumericOptions = [
+ [false, false],
+ [true, true],
+ [null, false],
+ [0, false],
+ [0.5, true],
+ ["true", true],
+ ["false", true],
+ [{ valueOf() { return false; } }, true],
+];
+for (const [numeric, expected] of validNumericOptions) {
+ let expect = expected ? "en-u-kn" : "en-u-kn-false";
+
+ assert.sameValue(
+ new Intl.Locale('en', {numeric}).toString(),
+ expect,
+ `new Intl.Locale("en", {numeric: ${numeric}}).toString() returns "${expected}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-kn-true', {numeric}).toString(),
+ expect,
+ `new Intl.Locale("en-u-kn-true", {numeric: ${numeric}}).toString() returns "${expected}"`
+ );
+
+ assert.sameValue(
+ new Intl.Locale('en-u-kf-lower', {numeric}).numeric,
+ expected,
+ `new Intl.Locale("en-u-kf-lower", {numeric: ${numeric}}).numeric equals "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-region-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-region-invalid.js
new file mode 100644
index 0000000000..5f5444b6b5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-region-invalid.js
@@ -0,0 +1,58 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 8. If region is not undefined, then
+ a. If region does not match the region production, throw a RangeError exception.
+ ...
+
+features: [Intl.Locale]
+---*/
+
+/*
+ region = 2ALPHA ; ISO 3166-1 code
+ / 3DIGIT ; UN M.49 code
+*/
+const invalidRegionOptions = [
+ "",
+ "a",
+ "abc",
+ "a7",
+
+ // Value cannot be parsed as a 'region' production.
+ "notaregion",
+
+ // Value contains more than just the 'region' production.
+ "SA-vaidika",
+ "SA-a-asdf",
+ "SA-x-private",
+
+ // Value contains more than just the 'script' production.
+ "ary-Arab",
+ "Latn-SA",
+ "Latn-vaidika",
+ "Latn-a-asdf",
+ "Latn-x-private",
+
+ 7,
+];
+for (const region of invalidRegionOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {region});
+ }, `new Intl.Locale("en", {region: "${region}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-region-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-region-valid.js
new file mode 100644
index 0000000000..f57fec2226
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-region-valid.js
@@ -0,0 +1,69 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 7. Let region be ? GetOption(options, "region", "string", undefined, undefined).
+ ...
+ 9. If tag matches neither the privateuse nor the grandfathered production, then
+ ...
+ d. If region is not undefined, then
+ i. If tag does not contain a region production, then
+ 1. Set tag to the concatenation of the language production of tag, the substring corresponding to the "-" script production if present, "-", region, and the rest of tag.
+ ii. Else,
+ 1. Set tag to tag with the substring corresponding to the region production replaced by the string region.
+
+features: [Intl.Locale]
+---*/
+
+const validRegionOptions = [
+ [undefined, undefined],
+ ['FR', 'en-FR'],
+ ['554', 'en-NZ'],
+ [554, 'en-NZ'],
+];
+for (const [region, expected] of validRegionOptions) {
+ let options = { region };
+ let expect = expected || 'en';
+
+ assert.sameValue(
+ new Intl.Locale('en', options).toString(),
+ expect,
+ `new Intl.Locale('en', {region: "${region}"}).toString() returns "${expect}"`
+ );
+
+ expect = expected || 'en-US';
+ assert.sameValue(
+ new Intl.Locale('en-US', options).toString(),
+ expect,
+ `new Intl.Locale('en-US', {region: "${region}"}).toString() returns "${expect}"`
+ );
+
+ expect = (expected || 'en') + '-u-ca-gregory';
+ assert.sameValue(
+ new Intl.Locale('en-u-ca-gregory', options).toString(),
+ expect,
+ `new Intl.Locale('en-u-ca-gregory', {region: "${region}"}).toString() returns "${expect}"`
+ );
+
+ expect = (expected || 'en-US') + '-u-ca-gregory';
+ assert.sameValue(
+ new Intl.Locale('en-US-u-ca-gregory', options).toString(),
+ expect,
+ `new Intl.Locale('en-US-u-ca-gregory', {region: "${region}"}).toString() returns "${expect}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-script-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-options-script-invalid.js
new file mode 100644
index 0000000000..01141210d5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-script-invalid.js
@@ -0,0 +1,54 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 6. If script is not undefined, then
+ a. If script does not match the script production, throw a RangeError exception.
+ ...
+
+features: [Intl.Locale]
+---*/
+
+/*
+ script = 4ALPHA ; ISO 15924 code
+*/
+const invalidScriptOptions = [
+ "",
+ "a",
+ "ab",
+ "abc",
+ "abc7",
+ "notascript",
+ "undefined",
+ "Bal\u0130",
+ "Bal\u0131",
+
+ // Value contains more than just the 'script' production.
+ "ary-Arab",
+ "Latn-SA",
+ "Latn-vaidika",
+ "Latn-a-asdf",
+ "Latn-x-private",
+
+ 7,
+];
+for (const script of invalidScriptOptions) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale("en", {script});
+ }, `new Intl.Locale("en", {script: "${script}"}) throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-script-valid-undefined.js b/js/src/tests/test262/intl402/Locale/constructor-options-script-valid-undefined.js
new file mode 100644
index 0000000000..470d865d26
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-script-valid-undefined.js
@@ -0,0 +1,50 @@
+// Copyright 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verify valid script option values (undefined)
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 5. Let script be ? GetOption(options, "script", "string", undefined, undefined).
+ ...
+ 9. If tag matches neither the privateuse nor the grandfathered production, then
+ ...
+ c. If script is not undefined, then
+ i. If tag does not contain a script production, then
+ 1. Set tag to the concatenation of the language production of tag, "-", script, and the rest of tag.
+ ii. Else,
+ 1. Set tag to tag with the substring corresponding to the script production replaced by the string script.
+
+
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(
+ new Intl.Locale('en', {script: undefined}).toString(),
+ 'en',
+ `new Intl.Locale('en', {script: undefined}).toString() returns "en"`
+);
+
+assert.sameValue(
+ new Intl.Locale('en-DK', {script: undefined}).toString(),
+ 'en-DK',
+ `new Intl.Locale('en-DK', {script: undefined}).toString() returns "en-DK"`
+);
+
+assert.sameValue(
+ new Intl.Locale('en-Cyrl', {script: undefined}).toString(),
+ 'en-Cyrl',
+ `new Intl.Locale('en-Cyrl', {script: undefined}).toString() returns "en-Cyrl"`
+);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-script-valid.js b/js/src/tests/test262/intl402/Locale/constructor-options-script-valid.js
new file mode 100644
index 0000000000..43fb26ff62
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-script-valid.js
@@ -0,0 +1,64 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verify valid language option values (various)
+info: |
+ Intl.Locale( tag [, options] )
+ 9. Else,
+ a. Let tag be ? ToString(tag).
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 5. Let script be ? GetOption(options, "script", "string", undefined, undefined).
+ ...
+ 9. If tag matches neither the privateuse nor the grandfathered production, then
+ ...
+ c. If script is not undefined, then
+ i. If tag does not contain a script production, then
+ 1. Set tag to the concatenation of the language production of tag, "-", script, and the rest of tag.
+ ii. Else,
+ 1. Set tag to tag with the substring corresponding to the script production replaced by the string script.
+
+
+features: [Intl.Locale]
+---*/
+
+const validScriptOptions = [
+ [null, 'Null'],
+ ['bali', 'Bali'],
+ ['Bali', 'Bali'],
+ ['bALI', 'Bali'],
+ [{ toString() { return 'Brai' } }, 'Brai'],
+];
+for (const [script, expected] of validScriptOptions) {
+ let expect = expected ? 'en-' + expected : 'en';
+
+ assert.sameValue(
+ new Intl.Locale('en', { script }).toString(),
+ expect,
+ `new Intl.Locale("en", {script: "${script}"}).toString() returns "${expect}"`
+ );
+
+ expect = (expected ? ('en-' + expected) : 'en') + '-DK';
+ assert.sameValue(
+ new Intl.Locale('en-DK', { script }).toString(),
+ expect,
+ `new Intl.Locale("en-DK", {script: "${script}"}).toString() returns "${expect}"`
+ );
+
+ expect = expected ? ('en-' + expected) : 'en-Cyrl';
+ assert.sameValue(
+ new Intl.Locale('en-Cyrl', { script }).toString(),
+ expect,
+ `new Intl.Locale("en-Cyrl", {script: "${script}"}).toString() returns "${expect}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-throwing-getters.js b/js/src/tests/test262/intl402/Locale/constructor-options-throwing-getters.js
new file mode 100644
index 0000000000..92418505ad
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-throwing-getters.js
@@ -0,0 +1,35 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale
+description: Checks the propagation of exceptions from the options for the Locale constructor.
+features: [Intl.Locale]
+---*/
+
+function CustomError() {}
+
+const options = [
+ "language",
+ "script",
+ "region",
+ "calendar",
+ "collation",
+ "hourCycle",
+ "caseFirst",
+ "numeric",
+ "numberingSystem",
+];
+
+for (const option of options) {
+ assert.throws(CustomError, () => {
+ new Intl.Locale("en", {
+ get [option]() {
+ throw new CustomError();
+ }
+ });
+ },
+ `new Intl.Locale("en", {get ${option}() {throw new CustomError();}}) throws CustomError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-parse-twice.js b/js/src/tests/test262/intl402/Locale/constructor-parse-twice.js
new file mode 100644
index 0000000000..361c2d107d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-parse-twice.js
@@ -0,0 +1,60 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the handling of options with grandfathered tags.
+info: |
+ Intl.Locale( tag [, options] )
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+ 14. Let calendar be ? GetOption(options, "calendar", "string", undefined, undefined).
+ 16. Set opt.[[ca]] to calendar.
+ 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys).
+
+ ApplyOptionsToTag( tag, options )
+ ...
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+
+ IsStructurallyValidLanguageTag ( locale )
+
+ The IsStructurallyValidLanguageTag abstract operation verifies that the
+ locale argument (which must be a String value)
+
+ represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+ Unicode Technical Standard 35 section 3.2, or successor,
+
+features: [Intl.Locale]
+---*/
+
+const testData = [
+ // Canonicalized version of "en-GB-oed", which we can add "US" to right away.
+ {
+ tag: "en-GB-oxendict",
+ options: {
+ region: "US",
+ calendar: "gregory",
+ },
+ canonical: "en-US-oxendict-u-ca-gregory",
+ },
+];
+
+for (const {tag, options, canonical} of testData) {
+ assert.sameValue(
+ new Intl.Locale(tag, options).toString(),
+ canonical,
+ `new Intl.Locale("${tag}", ${options}).toString() returns "${canonical}"`
+ );
+}
+
+assert.throws(RangeError, () =>
+ new Intl.Locale("no-bok", {region: "NO", calendar: "gregory"}));
+assert.throws(RangeError, () =>
+ new Intl.Locale("no-bok", {region: "SE", calendar: "gregory"}));
+assert.throws(RangeError, () =>
+ new Intl.Locale("no-bok-NO", {region: "SE", calendar: "gregory"}));
+assert.throws(RangeError, () =>
+ new Intl.Locale("no-bok-SE", {region: "NO", calendar: "gregory"}));
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-tag-tostring.js b/js/src/tests/test262/intl402/Locale/constructor-tag-tostring.js
new file mode 100644
index 0000000000..21472ca467
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-tag-tostring.js
@@ -0,0 +1,39 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the string conversion of the locale argument to the
+ Locale constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 8. If Type(tag) is Object and tag has an [[InitializedLocale]] internal slot, then
+ 9. Else,
+ a. Let tag be ? ToString(tag).
+features: [Intl.Locale]
+---*/
+
+function CustomError() {}
+function WrongCustomError() {}
+
+const errors = [
+ { get [Symbol.toPrimitive]() { throw new CustomError(); } },
+ { [Symbol.toPrimitive](hint) { assert.sameValue(hint, "string"); throw new CustomError(); } },
+ { get toString() { throw new CustomError(); }, get valueOf() { throw new WrongCustomError(); } },
+ { toString() { throw new CustomError(); }, get valueOf() { throw new WrongCustomError(); } },
+ { toString: undefined, get valueOf() { throw new CustomError(); } },
+ { toString: undefined, valueOf() { throw new CustomError(); } },
+ { toString() { return {} }, get valueOf() { throw new CustomError(); } },
+ { toString() { return {} }, valueOf() { throw new CustomError(); } },
+];
+
+for (const input of errors) {
+ assert.throws(CustomError, function() {
+ new Intl.Locale(input);
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-tag.js b/js/src/tests/test262/intl402/Locale/constructor-tag.js
new file mode 100644
index 0000000000..e84fcdbfb5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-tag.js
@@ -0,0 +1,59 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization of specific tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+ ...
+ 13. Return CanonicalizeLanguageTag(tag).
+features: [Intl.Locale]
+---*/
+
+const validLanguageTags = {
+ "eN": "en",
+ "en-gb": "en-GB",
+ "IT-LATN-iT": "it-Latn-IT",
+ "th-th-u-nu-thai": "th-TH-u-nu-thai",
+ "en-x-u-foo": "en-x-u-foo",
+ "en-a-bar-x-u-foo": "en-a-bar-x-u-foo",
+ "en-x-u-foo-a-bar": "en-x-u-foo-a-bar",
+ "en-u-baz-a-bar-x-u-foo": "en-a-bar-u-baz-x-u-foo",
+ "DE-1996": "de-1996", // unicode_language_subtag sep unicode_variant_subtag
+
+ // unicode_language_subtag (sep unicode_variant_subtag)*
+ "sl-ROZAJ-BISKE-1994": "sl-1994-biske-rozaj",
+ "zh-latn-pinyin-pinyin2": "zh-Latn-pinyin-pinyin2",
+};
+
+for (const [langtag, canonical] of Object.entries(validLanguageTags)) {
+ assert.sameValue(
+ new Intl.Locale(canonical).toString(),
+ canonical,
+ `new Intl.Locale("${canonical}").toString() returns "${canonical}"`
+ );
+ assert.sameValue(
+ new Intl.Locale(langtag).toString(),
+ canonical,
+ `new Intl.Locale("${langtag}").toString() returns "${canonical}"`
+ );
+}
+
+// unicode_language_subtag = alpha{2,3} | alpha{5,8};
+const invalidLanguageTags = [
+ "X-u-foo",
+ "Flob",
+ "ZORK",
+ "Blah-latn",
+ "QuuX-latn-us",
+ "SPAM-gb-x-Sausages-BACON-eggs",
+];
+
+for (const langtag of invalidLanguageTags) {
+ assert.throws(RangeError, () => new Intl.Locale(langtag));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-invalid.js b/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-invalid.js
new file mode 100644
index 0000000000..e069053dc5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-invalid.js
@@ -0,0 +1,33 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies treatment of specific structurally invalid tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+features: [Intl.Locale]
+---*/
+
+const invalidLanguageTags = [
+ // Unicode extension sequence is incomplete.
+ "da-u",
+ "da-u-",
+ "da-u--",
+ "da-u-t-latn",
+ "da-u-x-priv",
+
+ // Duplicate 'u' singleton.
+ "da-u-ca-gregory-u-ca-buddhist"
+];
+
+for (const langtag of invalidLanguageTags) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale(langtag)
+ },
+ `new Intl.Locale("${langtag}") throws RangeError`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js b/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js
new file mode 100644
index 0000000000..20c37c7981
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js
@@ -0,0 +1,40 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization of specific tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ 10. Return CanonicalizeLanguageTag(tag).
+features: [Intl.Locale]
+---*/
+
+const validLanguageTags = {
+ // Duplicate keywords are removed.
+ "da-u-ca-gregory-ca-buddhist": "da-u-ca-gregory",
+
+ // Keywords currently used in Intl specs are reordered in US-ASCII order.
+ "zh-u-nu-hans-ca-chinese": "zh-u-ca-chinese-nu-hans",
+ "zh-u-ca-chinese-nu-hans": "zh-u-ca-chinese-nu-hans",
+
+ // Even keywords currently not used in Intl specs are reordered in US-ASCII order.
+ "de-u-cu-eur-nu-latn": "de-u-cu-eur-nu-latn",
+ "de-u-nu-latn-cu-eur": "de-u-cu-eur-nu-latn",
+
+ // Attributes in Unicode extensions are reordered in US-ASCII order.
+ "pt-u-attr-ca-gregory": "pt-u-attr-ca-gregory",
+ "pt-u-attr1-attr2-ca-gregory": "pt-u-attr1-attr2-ca-gregory",
+ "pt-u-attr2-attr1-ca-gregory": "pt-u-attr1-attr2-ca-gregory",
+};
+
+for (const [langtag, canonical] of Object.entries(validLanguageTags)) {
+ assert.sameValue(
+ new Intl.Locale(langtag).toString(),
+ canonical,
+ `new Intl.Locale("${langtag}").toString() returns "${canonical}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/extensions-grandfathered.js b/js/src/tests/test262/intl402/Locale/extensions-grandfathered.js
new file mode 100644
index 0000000000..af4f9e0abc
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/extensions-grandfathered.js
@@ -0,0 +1,69 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies handling of options with grandfathered tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ ...
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+
+ IsStructurallyValidLanguageTag ( locale )
+
+ The IsStructurallyValidLanguageTag abstract operation verifies that the
+ locale argument (which must be a String value)
+
+ represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+ Unicode Technical Standard 35 section 3.2, or successor,
+
+features: [Intl.Locale]
+---*/
+
+const testData = [
+ // Regular grandfathered without modern replacement.
+ {
+ tag: "cel-gaulish",
+ options: {
+ language: "fr",
+ script: "Cyrl",
+ region: "FR",
+ numberingSystem: "latn",
+ },
+ canonical: "fr-Cyrl-FR-u-nu-latn",
+ },
+
+ // Regular grandfathered with modern replacement.
+ {
+ tag: "art-lojban",
+ options: {
+ language: "fr",
+ script: "Cyrl",
+ region: "ZZ",
+ numberingSystem: "latn",
+ },
+ canonical: "fr-Cyrl-ZZ-u-nu-latn",
+ },
+];
+
+for (const {tag, options, canonical} of testData) {
+ const loc = new Intl.Locale(tag, options);
+ assert.sameValue(loc.toString(), canonical);
+
+ for (const [name, value] of Object.entries(options)) {
+ assert.sameValue(loc[name], value);
+ }
+}
+
+assert.throws(RangeError, () =>
+ new Intl.Locale("i-default",
+ {language: "fr", script: "Cyrl", region: "DE", numberingSystem: "latn"}
+ ));
+
+assert.throws(RangeError, () =>
+ new Intl.Locale("en-gb-oed",
+ {language: "fr", script: "Cyrl", region: "US", numberingSystem: "latn"}
+ ));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/extensions-private.js b/js/src/tests/test262/intl402/Locale/extensions-private.js
new file mode 100644
index 0000000000..cd3771b57f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/extensions-private.js
@@ -0,0 +1,26 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies handling of options with privateuse tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+
+
+ ...
+ 9. If tag matches neither the privateuse nor the grandfathered production, then
+ ...
+
+features: [Intl.Locale]
+---*/
+
+assert.throws(RangeError, () => new Intl.Locale("x-default", {
+ language: "fr",
+ script: "Cyrl",
+ region: "DE",
+ numberingSystem: "latn",
+}));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/function-prototype.js b/js/src/tests/test262/intl402/Locale/function-prototype.js
new file mode 100644
index 0000000000..6127b8d129
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/function-prototype.js
@@ -0,0 +1,18 @@
+// Copyright 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ The value of the [[Prototype]] internal slot of the Intl.Locale constructor is the
+ intrinsic object %FunctionPrototype%.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(
+ Object.getPrototypeOf(Intl.Locale),
+ Function.prototype,
+ "Object.getPrototypeOf(Intl.Locale) equals the value of Function.prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/getters-grandfathered.js b/js/src/tests/test262/intl402/Locale/getters-grandfathered.js
new file mode 100644
index 0000000000..9df709545b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/getters-grandfathered.js
@@ -0,0 +1,41 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies getters with grandfathered tags.
+info: |
+ get Intl.Locale.prototype.baseName
+ 5. Return the substring of locale corresponding to the
+ language ["-" script] ["-" region] *("-" variant)
+ subsequence of the unicode_language_id grammar.
+
+ get Intl.Locale.prototype.language
+ 5. Return the substring of locale corresponding to the
+ unicode_language_subtag production.
+
+ get Intl.Locale.prototype.script
+ 6. Return the substring of locale corresponding to the
+ unicode_script_subtag production.
+
+ get Intl.Locale.prototype.region
+ 6. Return the substring of locale corresponding to the unicode_region_subtag
+ production.
+features: [Intl.Locale]
+---*/
+
+// Regular grandfathered language tag.
+var loc = new Intl.Locale("cel-gaulish");
+assert.sameValue(loc.baseName, "xtg");
+assert.sameValue(loc.language, "xtg");
+assert.sameValue(loc.script, undefined);
+assert.sameValue(loc.region, undefined);
+
+// Regular grandfathered language tag.
+assert.throws(RangeError, () => new Intl.Locale("zh-min"));
+
+assert.throws(RangeError, () => new Intl.Locale("i-default"));
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/getters-missing.js b/js/src/tests/test262/intl402/Locale/getters-missing.js
new file mode 100644
index 0000000000..2eaaec7282
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/getters-missing.js
@@ -0,0 +1,55 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies getters with missing tags.
+info: |
+ get Intl.Locale.prototype.baseName
+ 5. Return the substring of locale corresponding to the
+ language ["-" script] ["-" region] *("-" variant)
+ subsequence of the langtag grammar.
+
+ get Intl.Locale.prototype.language
+ 4. Return the substring of locale corresponding to the language production.
+
+ get Intl.Locale.prototype.script
+ 6. If locale does not contain the ["-" script] sequence, return undefined.
+ 7. Return the substring of locale corresponding to the script production.
+
+ get Intl.Locale.prototype.region
+ 6. If locale does not contain the ["-" region] sequence, return undefined.
+ 7. Return the substring of locale corresponding to the region production.
+features: [Intl.Locale]
+---*/
+
+// 'script' and 'region' subtags not present.
+var loc = new Intl.Locale("sv");
+assert.sameValue(loc.baseName, "sv");
+assert.sameValue(loc.language, "sv");
+assert.sameValue(loc.script, undefined);
+assert.sameValue(loc.region, undefined);
+
+// 'region' subtag not present.
+var loc = new Intl.Locale("sv-Latn");
+assert.sameValue(loc.baseName, "sv-Latn");
+assert.sameValue(loc.language, "sv");
+assert.sameValue(loc.script, "Latn");
+assert.sameValue(loc.region, undefined);
+
+// 'script' subtag not present.
+var loc = new Intl.Locale("sv-SE");
+assert.sameValue(loc.baseName, "sv-SE");
+assert.sameValue(loc.language, "sv");
+assert.sameValue(loc.script, undefined);
+assert.sameValue(loc.region, "SE");
+
+// 'variant' subtag present.
+var loc = new Intl.Locale("de-1901");
+assert.sameValue(loc.baseName, "de-1901");
+assert.sameValue(loc.language, "de");
+assert.sameValue(loc.script, undefined);
+assert.sameValue(loc.region, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/getters.js b/js/src/tests/test262/intl402/Locale/getters.js
new file mode 100644
index 0000000000..6454fb1460
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/getters.js
@@ -0,0 +1,124 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies getters with normal tags.
+info: |
+ Intl.Locale.prototype.toString ()
+ 3. Return loc.[[Locale]].
+
+ get Intl.Locale.prototype.baseName
+ 5. Return the substring of locale corresponding to the
+ language ["-" script] ["-" region] *("-" variant)
+ subsequence of the langtag grammar.
+
+ get Intl.Locale.prototype.language
+ 4. Return the substring of locale corresponding to the language production.
+
+ get Intl.Locale.prototype.script
+ 7. Return the substring of locale corresponding to the script production.
+
+ get Intl.Locale.prototype.region
+ 7. Return the substring of locale corresponding to the region production.
+
+ get Intl.Locale.prototype.calendar
+ 3. Return loc.[[Calendar]].
+
+ get Intl.Locale.prototype.collation
+ 3. Return loc.[[Collation]].
+
+ get Intl.Locale.prototype.hourCycle
+ 3. Return loc.[[HourCycle]].
+
+ get Intl.Locale.prototype.caseFirst
+ This property only exists if %Locale%.[[RelevantExtensionKeys]] contains "kf".
+ 3. Return loc.[[CaseFirst]].
+
+ get Intl.Locale.prototype.numeric
+ This property only exists if %Locale%.[[RelevantExtensionKeys]] contains "kn".
+ 3. Return loc.[[Numeric]].
+
+ get Intl.Locale.prototype.numberingSystem
+ 3. Return loc.[[NumberingSystem]].
+
+features: [Intl.Locale]
+---*/
+
+// Test all getters return the expected results.
+var langtag = "de-latn-de-u-ca-gregory-co-phonebk-hc-h23-kf-true-kn-false-nu-latn";
+var loc = new Intl.Locale(langtag);
+
+assert.sameValue(loc.toString(), "de-Latn-DE-u-ca-gregory-co-phonebk-hc-h23-kf-kn-false-nu-latn");
+assert.sameValue(loc.baseName, "de-Latn-DE");
+assert.sameValue(loc.language, "de");
+assert.sameValue(loc.script, "Latn");
+assert.sameValue(loc.region, "DE");
+assert.sameValue(loc.calendar, "gregory");
+assert.sameValue(loc.collation, "phonebk");
+assert.sameValue(loc.hourCycle, "h23");
+if ("caseFirst" in loc) {
+ assert.sameValue(loc.caseFirst, "");
+}
+if ("numeric" in loc) {
+ assert.sameValue(loc.numeric, false);
+}
+assert.sameValue(loc.numberingSystem, "latn");
+
+// Replace all components through option values and validate the getters still
+// return the expected results.
+var loc = new Intl.Locale(langtag, {
+ language: "ja",
+ script: "jpan",
+ region: "jp",
+ calendar: "japanese",
+ collation: "search",
+ hourCycle: "h24",
+ caseFirst: "false",
+ numeric: "true",
+ numberingSystem: "jpanfin",
+});
+
+assert.sameValue(loc.toString(), "ja-Jpan-JP-u-ca-japanese-co-search-hc-h24-kf-false-kn-nu-jpanfin");
+assert.sameValue(loc.baseName, "ja-Jpan-JP");
+assert.sameValue(loc.language, "ja");
+assert.sameValue(loc.script, "Jpan");
+assert.sameValue(loc.region, "JP");
+assert.sameValue(loc.calendar, "japanese");
+assert.sameValue(loc.collation, "search");
+assert.sameValue(loc.hourCycle, "h24");
+if ("caseFirst" in loc) {
+ assert.sameValue(loc.caseFirst, "false");
+}
+if ("numeric" in loc) {
+ assert.sameValue(loc.numeric, true);
+}
+assert.sameValue(loc.numberingSystem, "jpanfin");
+
+// Replace only some components through option values and validate the getters
+// return the expected results.
+var loc = new Intl.Locale(langtag, {
+ language: "fr",
+ region: "ca",
+ collation: "standard",
+ hourCycle: "h11",
+});
+
+assert.sameValue(loc.toString(), "fr-Latn-CA-u-ca-gregory-co-standard-hc-h11-kf-kn-false-nu-latn");
+assert.sameValue(loc.baseName, "fr-Latn-CA");
+assert.sameValue(loc.language, "fr");
+assert.sameValue(loc.script, "Latn");
+assert.sameValue(loc.region, "CA");
+assert.sameValue(loc.calendar, "gregory");
+assert.sameValue(loc.collation, "standard");
+assert.sameValue(loc.hourCycle, "h11");
+if ("caseFirst" in loc) {
+ assert.sameValue(loc.caseFirst, "");
+}
+if ("numeric" in loc) {
+ assert.sameValue(loc.numeric, false);
+}
+assert.sameValue(loc.numberingSystem, "latn");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/instance-extensibility.js b/js/src/tests/test262/intl402/Locale/instance-extensibility.js
new file mode 100644
index 0000000000..99a10021cb
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/instance-extensibility.js
@@ -0,0 +1,22 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Intl.Locale instance object extensibility
+info: |
+ 17 ECMAScript Standard Built-in Objects:
+
+ Unless specified otherwise, the [[Extensible]] internal slot
+ of a built-in object initially has the value true.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(
+ Object.isExtensible(new Intl.Locale('en')),
+ true,
+ "Object.isExtensible(new Intl.Locale('en')) returns true"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/instance.js b/js/src/tests/test262/intl402/Locale/instance.js
new file mode 100644
index 0000000000..24d1c2c5f5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/instance.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Intl.Locale instance object created from %LocalePrototype%.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 6. Let locale be ?
+ OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%,
+ internalSlotsList).
+features: [Intl.Locale]
+---*/
+
+const value = new Intl.Locale('en');
+assert.sameValue(
+ Object.getPrototypeOf(value),
+ Intl.Locale.prototype,
+ "Object.getPrototypeOf(value) equals the value of Intl.Locale.prototype"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/invalid-tag-throws-boolean.js b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-boolean.js
new file mode 100644
index 0000000000..a8ea22421d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-boolean.js
@@ -0,0 +1,24 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the type check on the tag argument to Intl.Locale.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 7. If Type(tag) is not String or Object, throw a TypeError exception.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(true);
+}, "true is an invalid tag value");
+assert.throws(TypeError, function() {
+ new Intl.Locale(false);
+}, "false is an invalid tag value");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/invalid-tag-throws-null.js b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-null.js
new file mode 100644
index 0000000000..9078819cd4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-null.js
@@ -0,0 +1,21 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the type check on the tag argument to Intl.Locale.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 7. If Type(tag) is not String or Object, throw a TypeError exception.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(null);
+}, "null is an invalid tag value");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/invalid-tag-throws-number.js b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-number.js
new file mode 100644
index 0000000000..28b1672f31
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-number.js
@@ -0,0 +1,34 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the type check on the tag argument to Intl.Locale.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 7. If Type(tag) is not String or Object, throw a TypeError exception.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(0);
+}, "0 is an invalid tag value");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(1);
+}, "1 is an invalid tag value");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(Infinity);
+}, "Infinity is an invalid tag value");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(NaN);
+}, "NaN is an invalid tag value");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/invalid-tag-throws-symbol.js b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-symbol.js
new file mode 100644
index 0000000000..887bd46da1
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-symbol.js
@@ -0,0 +1,21 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the type check on the tag argument to Intl.Locale.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 7. If Type(tag) is not String or Object, throw a TypeError exception.
+features: [Intl.Locale, Symbol]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(Symbol());
+}, "Symbol() is an invalid tag value");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/invalid-tag-throws-undefined.js b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-undefined.js
new file mode 100644
index 0000000000..f8184c5a29
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/invalid-tag-throws-undefined.js
@@ -0,0 +1,25 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies the type check on the tag argument to Intl.Locale.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 7. If Type(tag) is not String or Object, throw a TypeError exception.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale();
+}, "(empty) is an invalid tag value");
+
+assert.throws(TypeError, function() {
+ new Intl.Locale(undefined)
+}, "undefined is an invalid tag value");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/invalid-tag-throws.js b/js/src/tests/test262/intl402/Locale/invalid-tag-throws.js
new file mode 100644
index 0000000000..7b16250812
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/invalid-tag-throws.js
@@ -0,0 +1,41 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks error cases for the options argument to the Locale
+ constructor.
+info: |
+ Intl.Locale( tag [, options] )
+
+ ...
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+ ...
+
+ ApplyOptionsToTag( tag, options )
+
+ ...
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+ ...
+includes: [testIntl.js]
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+// Intl.Locale step 11.a.
+assert.throws(TypeError, function() { new Intl.Locale("en", null) })
+
+// ApplyOptionsToTag step 2.
+for (const invalidTag of getInvalidLanguageTags()) {
+ assert.throws(RangeError, function() {
+ new Intl.Locale(invalidTag);
+ }, `${invalidTag} is an invalid tag value`);
+}
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/length.js b/js/src/tests/test262/intl402/Locale/length.js
new file mode 100644
index 0000000000..34ad67c28e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/length.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "length" property of the Locale constructor.
+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 Locale 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.Locale]
+---*/
+
+verifyProperty(Intl.Locale, "length", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/likely-subtags-grandfathered.js b/js/src/tests/test262/intl402/Locale/likely-subtags-grandfathered.js
new file mode 100644
index 0000000000..56c3fe493a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/likely-subtags-grandfathered.js
@@ -0,0 +1,200 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization, minimization and maximization of specific tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+
+ 9. Set tag to CanonicalizeLanguageTag(tag).
+
+ CanonicalizeLanguageTag( tag )
+
+ The CanonicalizeLanguageTag abstract operation returns the canonical and
+ case-regularized form of the locale argument (which must be a String value
+ that is a structurally valid Unicode BCP 47 Locale Identifier as verified by
+ the IsStructurallyValidLanguageTag abstract operation).
+
+ IsStructurallyValidLanguageTag ( locale )
+
+ The IsStructurallyValidLanguageTag abstract operation verifies that the
+ locale argument (which must be a String value)
+
+ represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+ Unicode Technical Standard 35 section 3.2, or successor,
+
+
+ Intl.Locale.prototype.maximize ()
+ 3. Let maximal be the result of the Add Likely Subtags algorithm applied to loc.[[Locale]].
+
+ Intl.Locale.prototype.minimize ()
+ 3. Let minimal be the result of the Remove Likely Subtags algorithm applied to loc.[[Locale]].
+features: [Intl.Locale]
+---*/
+
+const irregularGrandfathered = [
+ "en-GB-oed",
+ "i-ami",
+ "i-bnn",
+ "i-default",
+ "i-enochian",
+ "i-hak",
+ "i-klingon",
+ "i-lux",
+ "i-mingo",
+ "i-navajo",
+ "i-pwn",
+ "i-tao",
+ "i-tay",
+ "i-tsu",
+ "sgn-BE-FR",
+ "sgn-BE-NL",
+ "sgn-CH-DE",
+];
+
+for (const tag of irregularGrandfathered) {
+ assert.throws(RangeError, () => new Intl.Locale(tag));
+}
+
+const regularGrandfathered = [
+ {
+ tag: "art-lojban",
+ canonical: "jbo",
+ maximized: "jbo-Latn-001",
+ },
+ {
+ tag: "cel-gaulish",
+ canonical: "xtg",
+ },
+ {
+ tag: "zh-guoyu",
+ canonical: "zh",
+ maximized: "zh-Hans-CN",
+ },
+ {
+ tag: "zh-hakka",
+ canonical: "hak",
+ maximized: "hak-Hans-CN",
+ },
+ {
+ tag: "zh-xiang",
+ canonical: "hsn",
+ maximized: "hsn-Hans-CN",
+ },
+];
+
+for (const {tag, canonical, maximized = canonical, minimized = canonical} of regularGrandfathered) {
+ const loc = new Intl.Locale(tag);
+ assert.sameValue(loc.toString(), canonical);
+
+ assert.sameValue(loc.maximize().toString(), maximized);
+ assert.sameValue(loc.maximize().maximize().toString(), maximized);
+
+ assert.sameValue(loc.minimize().toString(), minimized);
+ assert.sameValue(loc.minimize().minimize().toString(), minimized);
+
+ assert.sameValue(loc.maximize().minimize().toString(), minimized);
+ assert.sameValue(loc.minimize().maximize().toString(), maximized);
+}
+
+const regularGrandfatheredWithExtLang = [
+ "no-bok",
+ "no-nyn",
+ "zh-min",
+ "zh-min-nan",
+];
+
+for (const tag of regularGrandfatheredWithExtLang) {
+ assert.throws(RangeError, () => new Intl.Locale(tag));
+}
+
+// Add variants, extensions, and privateuse subtags to regular grandfathered
+// language tags and ensure it produces the "expected" result.
+const extras = [
+ "fonipa",
+ "a-not-assigned",
+ "u-attr",
+ "u-co",
+ "u-co-phonebk",
+ "x-private",
+];
+
+for (const {tag, canonical} of regularGrandfathered) {
+ const priv = "-x-0";
+ const tagMax = new Intl.Locale(canonical + priv).maximize().toString().slice(0, -priv.length);
+ const tagMin = new Intl.Locale(canonical + priv).minimize().toString().slice(0, -priv.length);
+
+ for (const extra of extras) {
+ const loc = new Intl.Locale(tag + "-" + extra);
+
+ let canonicalWithExtra = canonical + "-" + extra;
+ let canonicalMax = tagMax + "-" + extra;
+ let canonicalMin = tagMin + "-" + extra;
+
+ // Ensure the added variant subtag is correctly sorted in the canonical tag.
+ if (/^[a-z0-9]{5,8}|[0-9][a-z0-9]{3}$/i.test(extra)) {
+ const sorted = s => s.replace(/(-([a-z0-9]{5,8}|[0-9][a-z0-9]{3}))+$/i,
+ m => m.split("-").sort().join("-"));
+ canonicalWithExtra = sorted(canonicalWithExtra);
+ canonicalMax = sorted(canonicalMax);
+ canonicalMin = sorted(canonicalMin);
+ }
+
+ // Adding extra subtags to grandfathered tags can have "interesting" results. Take for
+ // example "art-lojban" when "fonipa" is added, so we get "art-lojban-fonipa". The first
+ // step when canonicalising the language tag is to bring it in 'canonical syntax', that
+ // means among other things sorting variants in alphabetical order. So "art-lojban-fonipa"
+ // is transformed to "art-fonipa-lojban", because "fonipa" is sorted before "lojban". And
+ // only after that has happened, we replace aliases with their preferred form.
+ //
+ // Now the usual problems arise when doing silly things like adding subtags to
+ // grandfathered subtags, nobody, neither RFC 5646 nor UTS 35, provides a clear description
+ // what needs to happen next.
+ //
+ // From <http://unicode.org/reports/tr35/#Language_Tag_to_Locale_Identifier>:
+ //
+ // > A valid [BCP47] language tag can be converted to a valid Unicode BCP 47 locale
+ // > identifier according to Annex C. LocaleId Canonicalization
+ //
+ // From <http://unicode.org/reports/tr35/#LocaleId_Canonicalization>
+ // > The languageAlias, scriptAlias, territoryAlias, and variantAlias elements are used
+ // > as rules to transform an input source localeId. The first step is to transform the
+ // > languageId portion of the localeId.
+ //
+ // For regular grandfathered tags, "lojban", "gaulish", "guoyu", "hakka", and "xiang" will
+ // therefore be considered as the "variant" subtag and be replaced by rules in languageAlias.
+ //
+ // Not all language tag processor will pass this test, for example because they don't order
+ // variant subtags in alphabetical order or they're too eager when detecting grandfathered
+ // tags. For example "zh-hakka-hakka" is accepted in some language tag processors, because
+ // the language tag starts with a prefix which matches a grandfathered tag, and that prefix
+ // is then canonicalised to "hak" and the second "hakka" is simply appended to it, so the
+ // resulting tag is "hak-hakka". This is clearly wrong as far as ECMA-402 compliance is
+ // concerned, because language tags are parsed and validated before any canonicalisation
+ // happens. And during the validation step an error should be emitted, because the input
+ // "zh-hakka-hakka" contains two identical variant subtags.
+ //
+ // From <https://tc39.es/ecma402/#sec-isstructurallyvalidlanguagetag>:
+ //
+ // > does not include duplicate variant subtags
+ //
+ // So, if your implementation fails this assertion, but you still like to test the rest of
+ // this file, a pull request to split this file seems the way to go!
+ assert.sameValue(loc.toString(), canonicalWithExtra);
+
+ assert.sameValue(loc.maximize().toString(), canonicalMax);
+ assert.sameValue(loc.maximize().maximize().toString(), canonicalMax);
+
+ assert.sameValue(loc.minimize().toString(), canonicalMin);
+ assert.sameValue(loc.minimize().minimize().toString(), canonicalMin);
+
+ assert.sameValue(loc.maximize().minimize().toString(), canonicalMin);
+ assert.sameValue(loc.minimize().maximize().toString(), canonicalMax);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/likely-subtags.js b/js/src/tests/test262/intl402/Locale/likely-subtags.js
new file mode 100644
index 0000000000..403ea2c7f2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/likely-subtags.js
@@ -0,0 +1,115 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization, minimization and maximization of specific tags.
+info: |
+ Intl.Locale.prototype.maximize ()
+ 3. Let maximal be the result of the Add Likely Subtags algorithm applied to loc.[[Locale]].
+
+ Intl.Locale.prototype.minimize ()
+ 3. Let minimal be the result of the Remove Likely Subtags algorithm applied to loc.[[Locale]].
+features: [Intl.Locale]
+---*/
+
+const testDataMaximal = {
+ // Language subtag is present.
+ "en": "en-Latn-US",
+
+ // Language and script subtags are present.
+ "en-Latn": "en-Latn-US",
+ "en-Shaw": "en-Shaw-GB",
+ "en-Arab": "en-Arab-US",
+
+ // Language and region subtags are present.
+ "en-US": "en-Latn-US",
+ "en-GB": "en-Latn-GB",
+ "en-FR": "en-Latn-FR",
+
+ // Language, script, and region subtags are present.
+ "it-Kana-CA": "it-Kana-CA",
+
+ // Undefined primary language.
+ "und": "en-Latn-US",
+ "und-Thai": "th-Thai-TH",
+ "und-419": "es-Latn-419",
+ "und-150": "en-Latn-150",
+ "und-AT": "de-Latn-AT",
+ "und-Cyrl-RO": "bg-Cyrl-RO",
+
+ // Before CLDR 44, "und" primary language subtag was left unchanged in some
+ // cases. Starting with CLDR 44, the "und" language subtag is always replaced.
+ "und-AQ": "en-Latn-AQ",
+};
+
+const testDataMinimal = {
+ // Language subtag is present.
+ "en": "en",
+
+ // Language and script subtags are present.
+ "en-Latn": "en",
+ "ar-Arab": "ar",
+
+ // Language and region subtags are present.
+ "en-US": "en",
+ "en-GB": "en-GB",
+
+ // Reverse cases from |testDataMaximal|.
+ "en-Latn-US": "en",
+ "en-Shaw-GB": "en-Shaw",
+ "en-Arab-US": "en-Arab",
+ "en-Latn-GB": "en-GB",
+ "en-Latn-FR": "en-FR",
+ "it-Kana-CA": "it-Kana-CA",
+ "th-Thai-TH": "th",
+ "es-Latn-419": "es-419",
+ "ru-Cyrl-RU": "ru",
+ "de-Latn-AT": "de-AT",
+ "bg-Cyrl-RO": "bg-RO",
+ "und-Latn-AQ": "en-AQ",
+};
+
+// Add variants, extensions, and privateuse subtags and ensure they don't
+// modify the result of the likely subtags algorithms.
+const extras = [
+ "",
+ "-fonipa",
+ "-a-not-assigned",
+ "-u-attr",
+ "-u-co",
+ "-u-co-phonebk",
+ "-x-private",
+];
+
+for (const [tag, maximal] of Object.entries(testDataMaximal)) {
+ assert.sameValue(new Intl.Locale(maximal).maximize().toString(), maximal,
+ `"${maximal}" should be maximal`);
+
+ for (const extra of extras) {
+ const input = tag + extra;
+ const output = maximal + extra;
+ assert.sameValue(new Intl.Locale(input).maximize().toString(), output,
+ `"${input}".maximize() should be "${output}"`);
+ }
+}
+
+for (const [tag, minimal] of Object.entries(testDataMinimal)) {
+ assert.sameValue(new Intl.Locale(minimal).minimize().toString(), minimal,
+ `"${minimal}" should be minimal`);
+
+ for (const extra of extras) {
+ const input = tag + extra;
+ const output = minimal + extra;
+ assert.sameValue(new Intl.Locale(input).minimize().toString(), output,
+ `"${input}".minimize() should be "${output}"`);
+ }
+}
+
+// privateuse only.
+// "x" in "x-private" does not match unicode_language_subtag
+// unicode_language_subtag = alpha{2,3} | alpha{5,8};
+assert.throws(RangeError, () => new Intl.Locale("x-private"));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/name.js b/js/src/tests/test262/intl402/Locale/name.js
new file mode 100644
index 0000000000..0def17d420
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/name.js
@@ -0,0 +1,23 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "name" property of the Locale constructor.
+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]
+---*/
+
+verifyProperty(Intl.Locale, "name", {
+ value: "Locale",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prop-desc.js b/js/src/tests/test262/intl402/Locale/prop-desc.js
new file mode 100644
index 0000000000..aab4c6aa7f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prop-desc.js
@@ -0,0 +1,35 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ "Locale" property of Intl.
+info: |
+ Intl.Locale (...)
+
+ 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]
+features: [Intl.Locale]
+---*/
+
+verifyProperty(Intl, "Locale", {
+ value: Intl.Locale,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/proto-from-ctor-realm.js b/js/src/tests/test262/intl402/Locale/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..3973759844
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/proto-from-ctor-realm.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale
+description: Default [[Prototype]] value derived from realm of the NewTarget.
+info: |
+ Intl.Locale ( tag [ , options] )
+
+ ...
+ 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%, internalSlotsList).
+ ...
+ 38. Return locale.
+
+ OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
+
+ ...
+ 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
+ 3. Return ObjectCreate(proto, internalSlotsList).
+
+ GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, 'prototype').
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Set proto to realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+features: [Intl.Locale, cross-realm, Reflect, Symbol]
+---*/
+
+var other = $262.createRealm().global;
+var newTarget = new other.Function();
+var locale;
+
+newTarget.prototype = undefined;
+locale = Reflect.construct(Intl.Locale, ['de'], newTarget);
+assert.sameValue(Object.getPrototypeOf(locale), other.Intl.Locale.prototype, 'newTarget.prototype is undefined');
+
+newTarget.prototype = null;
+locale = Reflect.construct(Intl.Locale, ['de'], newTarget);
+assert.sameValue(Object.getPrototypeOf(locale), other.Intl.Locale.prototype, 'newTarget.prototype is null');
+
+newTarget.prototype = true;
+locale = Reflect.construct(Intl.Locale, ['de'], newTarget);
+assert.sameValue(Object.getPrototypeOf(locale), other.Intl.Locale.prototype, 'newTarget.prototype is a Boolean');
+
+newTarget.prototype = 'str';
+locale = Reflect.construct(Intl.Locale, ['de'], newTarget);
+assert.sameValue(Object.getPrototypeOf(locale), other.Intl.Locale.prototype, 'newTarget.prototype is a String');
+
+newTarget.prototype = Symbol();
+locale = Reflect.construct(Intl.Locale, ['de'], newTarget);
+assert.sameValue(Object.getPrototypeOf(locale), other.Intl.Locale.prototype, 'newTarget.prototype is a Symbol');
+
+newTarget.prototype = 0;
+locale = Reflect.construct(Intl.Locale, ['de'], newTarget);
+assert.sameValue(Object.getPrototypeOf(locale), other.Intl.Locale.prototype, 'newTarget.prototype is a Number');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/baseName/branding.js b/js/src/tests/test262/intl402/Locale/prototype/baseName/branding.js
new file mode 100644
index 0000000000..8c8264aa0f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/baseName/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.baseName
+description: >
+ Verifies the branding check for the "baseName" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.baseName
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "baseName");
+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/baseName/browser.js b/js/src/tests/test262/intl402/Locale/prototype/baseName/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/baseName/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/baseName/name.js b/js/src/tests/test262/intl402/Locale/prototype/baseName/name.js
new file mode 100644
index 0000000000..f714d0a49a
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/baseName/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.baseName
+description: >
+ Checks the "name" property of Intl.Locale.prototype.baseName.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "baseName").get;
+verifyProperty(getter, "name", {
+ value: "get baseName",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/baseName/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/baseName/prop-desc.js
new file mode 100644
index 0000000000..e9050e724c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/baseName/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "baseName" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.baseName
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "baseName");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "baseName", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/baseName/shell.js b/js/src/tests/test262/intl402/Locale/prototype/baseName/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/baseName/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/browser.js b/js/src/tests/test262/intl402/Locale/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/calendar/branding.js b/js/src/tests/test262/intl402/Locale/prototype/calendar/branding.js
new file mode 100644
index 0000000000..27ae523895
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/calendar/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.calendar
+description: >
+ Verifies the branding check for the "calendar" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.calendar
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendar");
+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/calendar/browser.js b/js/src/tests/test262/intl402/Locale/prototype/calendar/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/calendar/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/calendar/name.js b/js/src/tests/test262/intl402/Locale/prototype/calendar/name.js
new file mode 100644
index 0000000000..ea316300a7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/calendar/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.calendar
+description: >
+ Checks the "name" property of Intl.Locale.prototype.calendar.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendar").get;
+verifyProperty(getter, "name", {
+ value: "get calendar",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/calendar/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/calendar/prop-desc.js
new file mode 100644
index 0000000000..7e125216f2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/calendar/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "calendar" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.calendar
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendar");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "calendar", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/calendar/shell.js b/js/src/tests/test262/intl402/Locale/prototype/calendar/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/calendar/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/caseFirst/branding.js b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/branding.js
new file mode 100644
index 0000000000..0506338c37
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/branding.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.Locale.prototype.caseFirst
+description: >
+ Verifies the branding check for the "caseFirst" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.caseFirst
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "caseFirst");
+if (propdesc !== undefined) {
+ 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/caseFirst/browser.js b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/caseFirst/name.js b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/name.js
new file mode 100644
index 0000000000..6b1f6fcd64
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/name.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.caseFirst
+description: >
+ Checks the "name" property of Intl.Locale.prototype.caseFirst.
+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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "caseFirst");
+if (propdesc !== undefined) {
+ const getter = propdesc.get;
+ verifyProperty(getter, "name", {
+ value: "get caseFirst",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/caseFirst/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/prop-desc.js
new file mode 100644
index 0000000000..d9528fab7f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/prop-desc.js
@@ -0,0 +1,29 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "caseFirst" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.caseFirst
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "caseFirst");
+if (propdesc) {
+ assert.sameValue(propdesc.set, undefined);
+ assert.sameValue(typeof propdesc.get, "function");
+
+ verifyProperty(Intl.Locale.prototype, "caseFirst", {
+ enumerable: false,
+ configurable: true,
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/caseFirst/shell.js b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/caseFirst/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/collation/branding.js b/js/src/tests/test262/intl402/Locale/prototype/collation/branding.js
new file mode 100644
index 0000000000..e3e2eb5794
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/collation/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.collation
+description: >
+ Verifies the branding check for the "collation" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.collation
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collation");
+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/collation/browser.js b/js/src/tests/test262/intl402/Locale/prototype/collation/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/collation/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/collation/name.js b/js/src/tests/test262/intl402/Locale/prototype/collation/name.js
new file mode 100644
index 0000000000..a45593e266
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/collation/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.collation
+description: >
+ Checks the "name" property of Intl.Locale.prototype.collation.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collation").get;
+verifyProperty(getter, "name", {
+ value: "get collation",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/collation/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/collation/prop-desc.js
new file mode 100644
index 0000000000..46de900d7b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/collation/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "collation" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.collation
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collation");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "collation", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/collation/shell.js b/js/src/tests/test262/intl402/Locale/prototype/collation/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/collation/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/constructor/browser.js b/js/src/tests/test262/intl402/Locale/prototype/constructor/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/constructor/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/constructor/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/constructor/prop-desc.js
new file mode 100644
index 0000000000..e0cff7c1e4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/constructor/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.constructor
+description: >
+ Checks the "constructor" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.constructor
+
+ The initial value of Intl.Locale.prototype.constructor is %Locale%.
+
+ 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]
+---*/
+
+verifyProperty(Intl.Locale.prototype, 'constructor', {
+ value: Intl.Locale,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/constructor/shell.js b/js/src/tests/test262/intl402/Locale/prototype/constructor/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/constructor/shell.js
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);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCalendars/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/branding.js
new file mode 100644
index 0000000000..b96024e71e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/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.getCalendars
+description: Verifies the branding check for the "getCalendars" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getCalendars ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getCalendars = Intl.Locale.prototype.getCalendars;
+
+assert.sameValue(typeof getCalendars, "function");
+
+assert.throws(TypeError, () => getCalendars.call(undefined), "undefined");
+assert.throws(TypeError, () => getCalendars.call(null), "null");
+assert.throws(TypeError, () => getCalendars.call(true), "true");
+assert.throws(TypeError, () => getCalendars.call(""), "empty string");
+assert.throws(TypeError, () => getCalendars.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getCalendars.call(1), "1");
+assert.throws(TypeError, () => getCalendars.call({}), "plain object");
+assert.throws(TypeError, () => getCalendars.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getCalendars.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCalendars/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCalendars/name.js b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/name.js
new file mode 100644
index 0000000000..faf5e8f723
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/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.getCalendars
+description: Checks the "name" property of Intl.Locale.prototype.getCalendars().
+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.getCalendars, "name", {
+ value: "getCalendars",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCalendars/output-array.js b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/output-array.js
new file mode 100644
index 0000000000..d52bca8fc9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/output-array.js
@@ -0,0 +1,19 @@
+// |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.getCalendars
+description: >
+ Checks that the return value of Intl.Locale.prototype.getCalendars is an Array.
+info: |
+ CalendarsOfLocale ( loc )
+ ...
+ 5. Return ! CreateArrayFromListAndPreferred( list, preferred ).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert(Array.isArray(new Intl.Locale('en').getCalendars()));
+assert(new Intl.Locale('en').getCalendars().length > 0, 'array has at least one element');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCalendars/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/prop-desc.js
new file mode 100644
index 0000000000..87cf922ef0
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/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.getCalendars
+description: Checks the "getCalendars" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getCalendars ()
+ 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.getCalendars,
+ "function",
+ "typeof Intl.Locale.prototype.getCalendars is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getCalendars", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getCalendars/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getCalendars/shell.js
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
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/branding.js
new file mode 100644
index 0000000000..ccbf1db7eb
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/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.getHourCycles
+description: Verifies the branding check for the "getHourCycles" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getHourCycles ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getHourCycles = Intl.Locale.prototype.getHourCycles;
+
+assert.sameValue(typeof getHourCycles, "function");
+
+assert.throws(TypeError, () => getHourCycles.call(undefined), "undefined");
+assert.throws(TypeError, () => getHourCycles.call(null), "null");
+assert.throws(TypeError, () => getHourCycles.call(true), "true");
+assert.throws(TypeError, () => getHourCycles.call(""), "empty string");
+assert.throws(TypeError, () => getHourCycles.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getHourCycles.call(1), "1");
+assert.throws(TypeError, () => getHourCycles.call({}), "plain object");
+assert.throws(TypeError, () => getHourCycles.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getHourCycles.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/name.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/name.js
new file mode 100644
index 0000000000..b81484eab4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/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.getHourCycles
+description: Checks the "name" property of Intl.Locale.prototype.getHourCycles().
+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.getHourCycles, "name", {
+ value: "getHourCycles",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array-values.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array-values.js
new file mode 100644
index 0000000000..037e31b48c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array-values.js
@@ -0,0 +1,27 @@
+// |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.getHourCycles
+description: >
+ Checks that the return value of Intl.Locale.prototype.getHourCycles is an Array
+ that only contains valid values.
+info: |
+ HourCyclesOfLocale ( loc )
+ ...
+ 4. Let list be a List of 1 or more unique hour cycle identifiers, which must
+ be lower case String values indicating either the 12-hour format ("h11",
+ "h12") or the 24-hour format ("h23", "h24"), sorted in descending preference
+ of those in common use for date and time formatting in locale.
+features: [Intl.Locale, Intl.Locale-info, Array.prototype.includes]
+---*/
+
+const output = new Intl.Locale('en').getHourCycles();
+assert(output.length > 0, 'array has at least one element');
+output.forEach(hc => {
+ if(!['h11', 'h12', 'h23', 'h24'].includes(hc))
+ throw new Test262Error();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/output-array.js
new file mode 100644
index 0000000000..57de2b2430
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/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.getHourCycles
+description: >
+ Checks that the return value of Intl.Locale.prototype.getHourCycles is an Array.
+info: |
+ HourCyclesOfLocale ( loc )
+ ...
+ 5. Return ! CreateArrayFromListAndPreferred( list, preferred ).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert(Array.isArray(new Intl.Locale('en').getHourCycles()));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/prop-desc.js
new file mode 100644
index 0000000000..6133a757f8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/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.getHourCycles
+description: Checks the "getHourCycles" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getHourCycles ()
+ 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.getHourCycles,
+ "function",
+ "typeof Intl.Locale.prototype.getHourCycles is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getHourCycles", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getHourCycles/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/branding.js
new file mode 100644
index 0000000000..4778789f97
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/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.getNumberingSystems
+description: Verifies the branding check for the "getNumberingSystems" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getNumberingSystems ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getNumberingSystems = Intl.Locale.prototype.getNumberingSystems;
+
+assert.sameValue(typeof getNumberingSystems, "function");
+
+assert.throws(TypeError, () => getNumberingSystems.call(undefined), "undefined");
+assert.throws(TypeError, () => getNumberingSystems.call(null), "null");
+assert.throws(TypeError, () => getNumberingSystems.call(true), "true");
+assert.throws(TypeError, () => getNumberingSystems.call(""), "empty string");
+assert.throws(TypeError, () => getNumberingSystems.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getNumberingSystems.call(1), "1");
+assert.throws(TypeError, () => getNumberingSystems.call({}), "plain object");
+assert.throws(TypeError, () => getNumberingSystems.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getNumberingSystems.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/name.js b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/name.js
new file mode 100644
index 0000000000..2bf49533e9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/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.getNumberingSystems
+description: Checks the "name" property of Intl.Locale.prototype.getNumberingSystems().
+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.getNumberingSystems, "name", {
+ value: "getNumberingSystems",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/output-array.js b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/output-array.js
new file mode 100644
index 0000000000..399f80a090
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/output-array.js
@@ -0,0 +1,19 @@
+// |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.getNumberingSystems
+description: >
+ Checks that the return value of Intl.Locale.prototype.getNumberingSystems is an Array.
+info: |
+ NumberingSystemsOfLocale ( loc )
+ ...
+ 5. Return ! CreateArrayFromListAndPreferred( list, preferred ).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert(Array.isArray(new Intl.Locale('en').getNumberingSystems()));
+assert(new Intl.Locale('en').getNumberingSystems().length > 0, 'array has at least one element');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/prop-desc.js
new file mode 100644
index 0000000000..ddc947d634
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/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.getNumberingSystems
+description: Checks the "getNumberingSystems" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getNumberingSystems ()
+ 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.getNumberingSystems,
+ "function",
+ "typeof Intl.Locale.prototype.getNumberingSystems is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getNumberingSystems", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getNumberingSystems/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/branding.js
new file mode 100644
index 0000000000..c8516ebb09
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/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.getTextInfo
+description: Verifies the branding check for the "getTextInfo" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getTextInfo ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getTextInfo = Intl.Locale.prototype.getTextInfo;
+
+assert.sameValue(typeof getTextInfo, "function");
+
+assert.throws(TypeError, () => getTextInfo.call(undefined), "undefined");
+assert.throws(TypeError, () => getTextInfo.call(null), "null");
+assert.throws(TypeError, () => getTextInfo.call(true), "true");
+assert.throws(TypeError, () => getTextInfo.call(""), "empty string");
+assert.throws(TypeError, () => getTextInfo.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getTextInfo.call(1), "1");
+assert.throws(TypeError, () => getTextInfo.call({}), "plain object");
+assert.throws(TypeError, () => getTextInfo.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getTextInfo.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/name.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/name.js
new file mode 100644
index 0000000000..5fc3d258d2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/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.getTextInfo
+description: Checks the "name" property of Intl.Locale.prototype.getTextInfo().
+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.getTextInfo, "name", {
+ value: "getTextInfo",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object-keys.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object-keys.js
new file mode 100644
index 0000000000..3fbb36a4d0
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object-keys.js
@@ -0,0 +1,34 @@
+// |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.getTextInfo
+description: >
+ Checks that the return value of Intl.Locale.prototype.getTextInfo is an Object
+ with the correct keys and properties.
+info: |
+ get Intl.Locale.prototype.getTextInfo
+ ...
+ 7. Perform ! CreateDataPropertyOrThrow(info, "direction", dir).
+features: [Intl.Locale,Intl.Locale-info]
+includes: [propertyHelper.js, compareArray.js]
+---*/
+
+const result = new Intl.Locale('en').getTextInfo();
+
+assert.compareArray(Reflect.ownKeys(result), ['direction']);
+
+verifyProperty(result, 'direction', {
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+const direction = new Intl.Locale('en').getTextInfo().direction;
+assert(
+ direction === 'rtl' || direction === 'ltr',
+ 'value of the `direction` property'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object.js
new file mode 100644
index 0000000000..7032f6155f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/output-object.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.getTextInfo
+description: >
+ Checks that the return value of Intl.Locale.prototype.getTextInfo is an Object.
+info: |
+ get Intl.Locale.prototype.getTextInfo
+ ...
+ 5. Let info be ! ObjectCreate(%Object.prototype%).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert.sameValue(Object.getPrototypeOf(new Intl.Locale('en').getTextInfo()), Object.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/prop-desc.js
new file mode 100644
index 0000000000..ae170b4646
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/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.getTextInfo
+description: Checks the "getTextInfo" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getTextInfo ()
+ 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.getTextInfo,
+ "function",
+ "typeof Intl.Locale.prototype.getTextInfo is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getTextInfo", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTextInfo/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/branding.js
new file mode 100644
index 0000000000..4305010e18
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/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.getTimeZones
+description: Verifies the branding check for the "getTimeZones" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getTimeZones ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getTimeZones = Intl.Locale.prototype.getTimeZones;
+
+assert.sameValue(typeof getTimeZones, "function");
+
+assert.throws(TypeError, () => getTimeZones.call(undefined), "undefined");
+assert.throws(TypeError, () => getTimeZones.call(null), "null");
+assert.throws(TypeError, () => getTimeZones.call(true), "true");
+assert.throws(TypeError, () => getTimeZones.call(""), "empty string");
+assert.throws(TypeError, () => getTimeZones.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getTimeZones.call(1), "1");
+assert.throws(TypeError, () => getTimeZones.call({}), "plain object");
+assert.throws(TypeError, () => getTimeZones.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getTimeZones.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/name.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/name.js
new file mode 100644
index 0000000000..0af95e77a5
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/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.getTimeZones
+description: Checks the "name" property of Intl.Locale.prototype.getTimeZones().
+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.getTimeZones, "name", {
+ value: "getTimeZones",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-sorted.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-sorted.js
new file mode 100644
index 0000000000..f492683d50
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-sorted.js
@@ -0,0 +1,25 @@
+// |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.getTimeZones
+description: >
+ Checks that the return value of Intl.Locale.prototype.getTimeZones is a sorted
+ Array.
+info: |
+ TimeZonesOfLocale ( loc )
+ ...
+ 4. Let list be a List of 1 or more unique time zone identifiers, which must be
+ String values indicating a Zone or Link name of the IANA Time Zone Database,
+ ordered as if an Array of the same values had been sorted using
+ %Array.prototype.sort% using undefined as comparefn, of those in common use
+ in region.
+features: [Intl.Locale,Intl.Locale-info]
+includes: [compareArray.js]
+---*/
+
+const output = new Intl.Locale('en-US').getTimeZones();
+assert.compareArray(output, [...output].sort());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-undefined.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-undefined.js
new file mode 100644
index 0000000000..3de4ce7cd9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array-undefined.js
@@ -0,0 +1,20 @@
+// |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.getTimeZones
+description: >
+ Checks that the return value of Intl.Locale.prototype.timeZones is undefined
+ when no region subtag is used.
+info: |
+ get Intl.Locale.prototype.timeZones
+ ...
+ 4. If the unicode_language_id production of locale does not contain the
+ ["-" unicode_region_subtag] sequence, return undefined.
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert.sameValue(new Intl.Locale('en').getTimeZones(), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array.js
new file mode 100644
index 0000000000..4cc3121096
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/output-array.js
@@ -0,0 +1,20 @@
+// |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.getTimeZones
+description: >
+ Checks that the return value of Intl.Locale.prototype.getTimeZones is an Array
+ when a region subtag is used.
+info: |
+ TimeZonesOfLocale ( loc )
+ ...
+ 5. Return ! CreateArrayFromListAndPreferred( list, preferred ).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert(Array.isArray(new Intl.Locale('en-US').getTimeZones()));
+assert(new Intl.Locale('en-US').getTimeZones().length > 0, 'array has at least one element');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/prop-desc.js
new file mode 100644
index 0000000000..0dff234d1e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/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.getTimeZones
+description: Checks the "getTimeZones" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getTimeZones ()
+ 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.getTimeZones,
+ "function",
+ "typeof Intl.Locale.prototype.getTimeZones is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getTimeZones", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getTimeZones/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/branding.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/branding.js
new file mode 100644
index 0000000000..de77d1d1a7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/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.getWeekInfo
+description: Verifies the branding check for the "getWeekInfo" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getWeekInfo ()
+
+ 2. Perform ? RequireInternalSlot(loc, [[InitializedLocale]]).
+
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+const getWeekInfo = Intl.Locale.prototype.getWeekInfo;
+
+assert.sameValue(typeof getWeekInfo, "function");
+
+assert.throws(TypeError, () => getWeekInfo.call(undefined), "undefined");
+assert.throws(TypeError, () => getWeekInfo.call(null), "null");
+assert.throws(TypeError, () => getWeekInfo.call(true), "true");
+assert.throws(TypeError, () => getWeekInfo.call(""), "empty string");
+assert.throws(TypeError, () => getWeekInfo.call(Symbol()), "symbol");
+assert.throws(TypeError, () => getWeekInfo.call(1), "1");
+assert.throws(TypeError, () => getWeekInfo.call({}), "plain object");
+assert.throws(TypeError, () => getWeekInfo.call(Intl.Locale), "Intl.Locale");
+assert.throws(TypeError, () => getWeekInfo.call(Intl.Locale.prototype), "Intl.Locale.prototype");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/browser.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-id.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-id.js
new file mode 100644
index 0000000000..9eedea5b8c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-id.js
@@ -0,0 +1,34 @@
+// |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.getWeekInfo
+description: >
+ Checks that the return value of Intl.Locale.prototype.getWeekInfo is an Object
+ with the correct keys and properties.
+info: |
+ get Intl.Locale.prototype.getWeekInfo
+ ...
+ 6. Perform ! CreateDataPropertyOrThrow(info, "firstDay", wi.[[FirstDay]]).
+features: [Reflect,Intl.Locale,Intl.Locale-info]
+---*/
+
+const validFirstDayOfWeekIds = [
+ ["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 validFirstDayOfWeekIds) {
+ assert.sameValue(
+ new Intl.Locale(id).getWeekInfo().firstDay,
+ expected,
+ `new Intl.Locale(${id}).getWeekInfo().firstDay returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-option.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-option.js
new file mode 100644
index 0000000000..9b0619c810
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/firstDay-by-option.js
@@ -0,0 +1,55 @@
+// |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.getWeekInfo
+description: >
+ Checks that the return value of Intl.Locale.prototype.getWeekInfo is an Object
+ with the correct keys and properties.
+info: |
+ get Intl.Locale.prototype.getWeekInfo
+ ...
+ 6. Perform ! CreateDataPropertyOrThrow(info, "firstDay", wi.[[FirstDay]]).
+features: [Reflect,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 }).getWeekInfo().firstDay,
+ expected,
+ `new Intl.Locale("en", { firstDayOfWeek: ${firstDayOfWeek} }).getWeekInfo().firstDay returns "${expected}"`
+ );
+ assert.sameValue(
+ new Intl.Locale('en-u-fw-WED', { firstDayOfWeek }).getWeekInfo().firstDay,
+ expected,
+ `new Intl.Locale("en-u-fw-WED", { firstDayOfWeek: ${firstDayOfWeek} }).firstDayOfWeek returns "${expected}"`
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/name.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/name.js
new file mode 100644
index 0000000000..b834ac2749
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/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.getWeekInfo
+description: Checks the "name" property of Intl.Locale.prototype.getWeekInfo().
+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.getWeekInfo, "name", {
+ value: "getWeekInfo",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object-keys.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object-keys.js
new file mode 100644
index 0000000000..0d3da38f07
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object-keys.js
@@ -0,0 +1,67 @@
+// |reftest| skip -- Intl.Locale-info is not supported
+// Copyright 2021 Igalia, S.L. All rights reserved.
+// Copyright 2021 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.getWeekInfo
+description: >
+ Checks that the return value of Intl.Locale.prototype.getWeekInfo is an Object
+ with the correct keys and properties.
+info: |
+ get Intl.Locale.prototype.getWeekInfo
+ ...
+ 6. Perform ! CreateDataPropertyOrThrow(info, "firstDay", wi.[[FirstDay]]).
+ 7. Perform ! CreateDataPropertyOrThrow(info, "weekend", we).
+ 8. Perform ! CreateDataPropertyOrThrow(info, "minimalDays", wi.[[MinimalDays]]).
+ ...
+ CreateDataProperty ( O, P, V )
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true,
+ [[Enumerable]]: true, [[Configurable]]: true }.
+features: [Reflect,Intl.Locale,Intl.Locale-info]
+includes: [propertyHelper.js, compareArray.js]
+---*/
+
+const result = new Intl.Locale('en').getWeekInfo();
+function isIntegerBetweenOneAndSeven(value) {
+ return value === 1 || value === 2 || value === 3 || value === 4 || value === 5 || value === 6 || value === 7;
+}
+
+assert.compareArray(Reflect.ownKeys(result), ['firstDay', 'weekend', 'minimalDays']);
+
+verifyProperty(result, 'firstDay', {
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+assert(
+ isIntegerBetweenOneAndSeven(new Intl.Locale('en').getWeekInfo().firstDay),
+ '`firstDay` must be an integer between one and seven (inclusive)'
+);
+
+verifyProperty(result, 'weekend', {
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+assert(
+ new Intl.Locale('en').getWeekInfo().weekend.every(isIntegerBetweenOneAndSeven),
+ '`weekend` must include integers between one and seven (inclusive)'
+);
+
+let original = new Intl.Locale('en').getWeekInfo().weekend;
+let sorted = original.slice().sort();
+assert.compareArray(original, sorted);
+
+verifyProperty(result, 'minimalDays', {
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+assert(
+ isIntegerBetweenOneAndSeven(new Intl.Locale('en').getWeekInfo().minimalDays),
+ '`minimalDays` must be an integer between one and seven (inclusive)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object.js
new file mode 100644
index 0000000000..b799a3db78
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/output-object.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.getWeekInfo
+description: >
+ Checks that the return value of Intl.Locale.prototype.getWeekInfo is an Object.
+info: |
+ get Intl.Locale.prototype.getWeekInfo
+ ...
+ 5. Let info be ! ObjectCreate(%Object.prototype%).
+features: [Intl.Locale,Intl.Locale-info]
+---*/
+
+assert.sameValue(Object.getPrototypeOf(new Intl.Locale('en').getWeekInfo()), Object.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/prop-desc.js
new file mode 100644
index 0000000000..2ed856a03d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/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.getWeekInfo
+description: Checks the "getWeekInfo" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.getWeekInfo ()
+ 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.getWeekInfo,
+ "function",
+ "typeof Intl.Locale.prototype.getWeekInfo is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "getWeekInfo", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/shell.js b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/getWeekInfo/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/hourCycle/branding.js b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/branding.js
new file mode 100644
index 0000000000..1716b0ff33
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.hourCycle
+description: >
+ Verifies the branding check for the "hourCycle" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.hourCycle
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycle");
+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/hourCycle/browser.js b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/hourCycle/name.js b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/name.js
new file mode 100644
index 0000000000..b40e2c6895
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.hourCycle
+description: >
+ Checks the "name" property of Intl.Locale.prototype.hourCycle.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycle").get;
+verifyProperty(getter, "name", {
+ value: "get hourCycle",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/hourCycle/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/prop-desc.js
new file mode 100644
index 0000000000..1f96c725b8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "hourCycle" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.hourCycle
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycle");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "hourCycle", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/hourCycle/shell.js b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/hourCycle/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/language/branding.js b/js/src/tests/test262/intl402/Locale/prototype/language/branding.js
new file mode 100644
index 0000000000..b9da32ac87
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/language/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.language
+description: >
+ Verifies the branding check for the "language" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.language
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "language");
+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/language/browser.js b/js/src/tests/test262/intl402/Locale/prototype/language/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/language/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/language/name.js b/js/src/tests/test262/intl402/Locale/prototype/language/name.js
new file mode 100644
index 0000000000..089953cbda
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/language/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.language
+description: >
+ Checks the "name" property of Intl.Locale.prototype.language.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "language").get;
+verifyProperty(getter, "name", {
+ value: "get language",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/language/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/language/prop-desc.js
new file mode 100644
index 0000000000..d2efe7ffa4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/language/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "language" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.language
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "language");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "language", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/language/shell.js b/js/src/tests/test262/intl402/Locale/prototype/language/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/language/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/maximize/branding.js b/js/src/tests/test262/intl402/Locale/prototype/maximize/branding.js
new file mode 100644
index 0000000000..38dbb77c52
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/maximize/branding.js
@@ -0,0 +1,35 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.maximize
+description: >
+ Verifies the branding check for the "maximize" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.maximize
+
+ 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]
+---*/
+
+const maximize = Intl.Locale.prototype.maximize;
+
+assert.sameValue(typeof maximize, "function");
+
+const invalidValues = [
+ undefined,
+ null,
+ true,
+ "",
+ Symbol(),
+ 1,
+ {},
+ Intl.Locale.prototype,
+];
+
+for (const invalidValue of invalidValues) {
+ assert.throws(TypeError, () => maximize.call(invalidValue));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/maximize/browser.js b/js/src/tests/test262/intl402/Locale/prototype/maximize/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/maximize/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/maximize/length.js b/js/src/tests/test262/intl402/Locale/prototype/maximize/length.js
new file mode 100644
index 0000000000..add94c6696
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/maximize/length.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.maximize
+description: >
+ Checks the "length" property of Intl.Locale.prototype.maximize().
+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 Locale 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.Locale]
+---*/
+
+verifyProperty(Intl.Locale.prototype.maximize, 'length', {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/maximize/name.js b/js/src/tests/test262/intl402/Locale/prototype/maximize/name.js
new file mode 100644
index 0000000000..259f91a34c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/maximize/name.js
@@ -0,0 +1,23 @@
+// Copyright 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.maximize
+description: >
+ Checks the "name" property of Intl.Locale.prototype.maximize().
+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]
+---*/
+
+verifyProperty(Intl.Locale.prototype.maximize, 'name', {
+ value: 'maximize',
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/maximize/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/maximize/prop-desc.js
new file mode 100644
index 0000000000..990e8d4455
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/maximize/prop-desc.js
@@ -0,0 +1,31 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.maximize
+description: >
+ Checks the "maximize" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.maximize ()
+
+ 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]
+---*/
+
+assert.sameValue(
+ typeof Intl.Locale.prototype.maximize,
+ 'function',
+ 'typeof Intl.Locale.prototype.maximize is function'
+);
+
+verifyProperty(Intl.Locale.prototype, 'maximize', {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/maximize/shell.js b/js/src/tests/test262/intl402/Locale/prototype/maximize/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/maximize/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/branding.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/branding.js
new file mode 100644
index 0000000000..c86f491323
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/branding.js
@@ -0,0 +1,35 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.minimize
+description: >
+ Verifies the branding check for the "minimize" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.minimize
+
+ 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]
+---*/
+
+const minimize = Intl.Locale.prototype.minimize;
+
+assert.sameValue(typeof minimize, "function");
+
+const invalidValues = [
+ undefined,
+ null,
+ true,
+ "",
+ Symbol(),
+ 1,
+ {},
+ Intl.Locale.prototype,
+];
+
+for (const invalidValue of invalidValues) {
+ assert.throws(TypeError, () => minimize.call(invalidValue));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/browser.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/length.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/length.js
new file mode 100644
index 0000000000..ad329cd3be
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/length.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.minimize
+description: >
+ Checks the "length" property of Intl.Locale.prototype.minimize().
+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 Locale 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.Locale]
+---*/
+
+verifyProperty(Intl.Locale.prototype.minimize, 'length', {
+ value: 0,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/name.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/name.js
new file mode 100644
index 0000000000..5a67ae8956
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/name.js
@@ -0,0 +1,23 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.minimize
+description: >
+ Checks the "name" property of Intl.Locale.prototype.minimize().
+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]
+---*/
+
+verifyProperty(Intl.Locale.prototype.minimize, 'name', {
+ value: 'minimize',
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/prop-desc.js
new file mode 100644
index 0000000000..f389b23797
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/prop-desc.js
@@ -0,0 +1,30 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "minimize" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.minimize ()
+
+ 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]
+---*/
+
+assert.sameValue(
+ typeof Intl.Locale.prototype.minimize,
+ 'function',
+ 'typeof Intl.Locale.prototype.minimize is function'
+);
+
+verifyProperty(Intl.Locale.prototype, 'minimize', {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js
new file mode 100644
index 0000000000..7ee1c4ba49
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js
@@ -0,0 +1,51 @@
+// Copyright 2020 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.minimize
+description: >
+ The "Remove Likely Subtags" algorithm adds likely subtags before processing the locale.
+info: |
+ Intl.Locale.prototype.minimize ()
+ 3. Let minimal be the result of the Remove Likely Subtags algorithm applied to loc.[[Locale]].
+ If an error is signaled, set minimal to loc.[[Locale]].
+
+ UTS 35, §4.3 Likely Subtags
+ Remove Likely Subtags
+
+ 1. First get max = AddLikelySubtags(inputLocale). If an error is signaled, return it.
+ 2. ...
+features: [Intl.Locale]
+---*/
+
+var testDataMinimal = {
+ // Undefined primary language.
+ "und": "en",
+ "und-Thai": "th",
+ "und-419": "es-419",
+ "und-150": "en-150",
+ "und-AT": "de-AT",
+
+ // https://unicode-org.atlassian.net/browse/ICU-13786
+ "aae-Latn-IT": "aae",
+ "aae-Thai-CO": "aae-Thai-CO",
+
+ // https://unicode-org.atlassian.net/browse/ICU-10220
+ // https://unicode-org.atlassian.net/browse/ICU-12345
+ "und-CW": "pap",
+ "und-US": "en",
+ "zh-Hant": "zh-TW",
+ "zh-Hani": "zh-Hani",
+};
+
+for (const [tag, minimal] of Object.entries(testDataMinimal)) {
+ // Assert the |minimal| tag is indeed minimal.
+ assert.sameValue(new Intl.Locale(minimal).minimize().toString(), minimal,
+ `"${minimal}" should be minimal`);
+
+ // Assert RemoveLikelySubtags(tag) returns |minimal|.
+ assert.sameValue(new Intl.Locale(tag).minimize().toString(), minimal,
+ `"${tag}".minimize() should be "${minimal}"`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/minimize/shell.js b/js/src/tests/test262/intl402/Locale/prototype/minimize/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/minimize/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/branding.js b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/branding.js
new file mode 100644
index 0000000000..6b736e9292
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.numberingSystem
+description: >
+ Verifies the branding check for the "numberingSystem" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.numberingSystem
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystem");
+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/numberingSystem/browser.js b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/name.js b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/name.js
new file mode 100644
index 0000000000..1e0b908694
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.numberingSystem
+description: >
+ Checks the "name" property of Intl.Locale.prototype.numberingSystem.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystem").get;
+verifyProperty(getter, "name", {
+ value: "get numberingSystem",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/prop-desc.js
new file mode 100644
index 0000000000..4f6f62a7c2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "numberingSystem" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.numberingSystem
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystem");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "numberingSystem", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/shell.js b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numberingSystem/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numeric/branding.js b/js/src/tests/test262/intl402/Locale/prototype/numeric/branding.js
new file mode 100644
index 0000000000..df1354be4e
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numeric/branding.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.Locale.prototype.numeric
+description: >
+ Verifies the branding check for the "numeric" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.numeric
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numeric");
+if (propdesc !== undefined) {
+ 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/numeric/browser.js b/js/src/tests/test262/intl402/Locale/prototype/numeric/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numeric/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numeric/name.js b/js/src/tests/test262/intl402/Locale/prototype/numeric/name.js
new file mode 100644
index 0000000000..db01e07741
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numeric/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.numeric
+description: >
+ Checks the "name" property of Intl.Locale.prototype.numeric.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numeric").get;
+verifyProperty(getter, "name", {
+ value: "get numeric",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numeric/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/numeric/prop-desc.js
new file mode 100644
index 0000000000..d361b3e5a2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numeric/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "numeric" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.numeric
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numeric");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "numeric", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/numeric/shell.js b/js/src/tests/test262/intl402/Locale/prototype/numeric/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/numeric/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/prop-desc.js
new file mode 100644
index 0000000000..f31eec1c25
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/prop-desc.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype
+description: >
+ Checks the "prototype" property of the Locale constructor.
+info: |
+ Intl.Locale.prototype
+
+ The value of Intl.Locale.prototype is %LocalePrototype%.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [Intl.Locale]
+---*/
+
+verifyProperty(Intl.Locale, 'prototype', {
+ writable: false,
+ enumerable: false,
+ configurable: false,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/region/branding.js b/js/src/tests/test262/intl402/Locale/prototype/region/branding.js
new file mode 100644
index 0000000000..47b07ae9e8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/region/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.region
+description: >
+ Verifies the branding check for the "region" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.region
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "region");
+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/region/browser.js b/js/src/tests/test262/intl402/Locale/prototype/region/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/region/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/region/name.js b/js/src/tests/test262/intl402/Locale/prototype/region/name.js
new file mode 100644
index 0000000000..5aabb93dda
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/region/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.region
+description: >
+ Checks the "name" property of Intl.Locale.prototype.region.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "region").get;
+verifyProperty(getter, "name", {
+ value: "get region",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/region/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/region/prop-desc.js
new file mode 100644
index 0000000000..ca3a753cd7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/region/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "region" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.region
+
+ 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 ECMAregion objects in the ECMAregion 2019 region 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "region");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "region", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/region/shell.js b/js/src/tests/test262/intl402/Locale/prototype/region/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/region/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/script/branding.js b/js/src/tests/test262/intl402/Locale/prototype/script/branding.js
new file mode 100644
index 0000000000..ffa1e8f66d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/script/branding.js
@@ -0,0 +1,32 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.script
+description: >
+ Verifies the branding check for the "script" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.script
+
+ 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "script");
+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/script/browser.js b/js/src/tests/test262/intl402/Locale/prototype/script/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/script/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/script/name.js b/js/src/tests/test262/intl402/Locale/prototype/script/name.js
new file mode 100644
index 0000000000..a36f0fbbea
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/script/name.js
@@ -0,0 +1,24 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype.script
+description: >
+ Checks the "name" property of Intl.Locale.prototype.script.
+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]
+---*/
+
+const getter = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "script").get;
+verifyProperty(getter, "name", {
+ value: "get script",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/script/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/script/prop-desc.js
new file mode 100644
index 0000000000..3a510e34c9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/script/prop-desc.js
@@ -0,0 +1,27 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "script" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.script
+
+ 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 script 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]
+---*/
+
+const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "script");
+assert.sameValue(propdesc.set, undefined);
+assert.sameValue(typeof propdesc.get, "function");
+
+verifyProperty(Intl.Locale.prototype, "script", {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/script/shell.js b/js/src/tests/test262/intl402/Locale/prototype/script/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/script/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/shell.js b/js/src/tests/test262/intl402/Locale/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toString/branding.js b/js/src/tests/test262/intl402/Locale/prototype/toString/branding.js
new file mode 100644
index 0000000000..8b14ec4fb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toString/branding.js
@@ -0,0 +1,35 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale.prototype.toString
+description: >
+ Verifies the branding check for the "toString" function of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.toString
+
+ 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]
+---*/
+
+const toString = Intl.Locale.prototype.toString;
+
+assert.sameValue(typeof toString, "function");
+
+const invalidValues = [
+ undefined,
+ null,
+ true,
+ "",
+ Symbol(),
+ 1,
+ {},
+ Intl.Locale.prototype,
+];
+
+for (const invalidValue of invalidValues) {
+ assert.throws(TypeError, () => toString.call(invalidValue));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toString/browser.js b/js/src/tests/test262/intl402/Locale/prototype/toString/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toString/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toString/prop-desc.js b/js/src/tests/test262/intl402/Locale/prototype/toString/prop-desc.js
new file mode 100644
index 0000000000..5ab7eaeac4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toString/prop-desc.js
@@ -0,0 +1,30 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Checks the "toString" property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype.toString ()
+
+ 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]
+---*/
+
+assert.sameValue(
+ typeof Intl.Locale.prototype.toString,
+ "function",
+ "typeof Intl.Locale.prototype.toString is function"
+);
+
+verifyProperty(Intl.Locale.prototype, "toString", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toString/shell.js b/js/src/tests/test262/intl402/Locale/prototype/toString/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toString/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toStringTag/browser.js b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/browser.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toStringTag/shell.js b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString-removed-tag.js b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString-removed-tag.js
new file mode 100644
index 0000000000..116caedeb7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString-removed-tag.js
@@ -0,0 +1,20 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype-@@tostringtag
+description: >
+ Checks Object.prototype.toString with Intl.Locale objects.
+info: |
+ Intl.Locale.prototype[ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the string value "Intl.Locale".
+features: [Intl.Locale, Symbol.toStringTag]
+---*/
+
+delete Intl.Locale.prototype[Symbol.toStringTag];
+
+assert.sameValue(Object.prototype.toString.call(Intl.Locale.prototype), "[object Object]");
+assert.sameValue(Object.prototype.toString.call(new Intl.Locale("en")), "[object Object]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString.js b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString.js
new file mode 100644
index 0000000000..42896406e3
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toString.js
@@ -0,0 +1,18 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype-@@tostringtag
+description: >
+ Checks Object.prototype.toString with Intl.Locale objects.
+info: |
+ Intl.Locale.prototype[ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the string value "Intl.Locale".
+features: [Intl.Locale, Symbol.toStringTag]
+---*/
+
+assert.sameValue(Object.prototype.toString.call(Intl.Locale.prototype), "[object Intl.Locale]");
+assert.sameValue(Object.prototype.toString.call(new Intl.Locale("en")), "[object Intl.Locale]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toStringTag.js b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toStringTag.js
new file mode 100644
index 0000000000..d58a240de7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/prototype/toStringTag/toStringTag.js
@@ -0,0 +1,25 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale.prototype-@@tostringtag
+description: >
+ Checks the @@toStringTag property of the Locale prototype object.
+info: |
+ Intl.Locale.prototype[ @@toStringTag ]
+
+ The initial value of the @@toStringTag property is the string value "Intl.Locale".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.Locale, Symbol.toStringTag]
+---*/
+
+verifyProperty(Intl.Locale.prototype, Symbol.toStringTag, {
+ value: 'Intl.Locale',
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/reject-duplicate-variants-in-tlang.js b/js/src/tests/test262/intl402/Locale/reject-duplicate-variants-in-tlang.js
new file mode 100644
index 0000000000..c2d01bc0b9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/reject-duplicate-variants-in-tlang.js
@@ -0,0 +1,52 @@
+// Copyright 2020 Jeff Walden, Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-isstructurallyvalidlanguagetag
+description: >
+ Verifies that just as duplicate variants in a tag ("en-emodeng-emodeng") make
+ the tag structurally invalid, so too do duplicate variants in the tlang
+ component of an otherwise structurally valid tag ("de-t-emodeng-emodeng"),
+ make it structurally invalid.
+info: |
+ if a `transformed_extensions` component that contains a `tlang` component is
+ present, then
+ the `tlang` component contains no duplicate `unicode_variant_subtag`
+ subtags.
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+function mustReject(tag) {
+ assert.throws(RangeError, () => {
+ // Direct matches are rejected.
+ new Intl.Locale(tag);
+ }, `tag "${tag}" must be considered structurally invalid`);
+}
+
+// BCP47 since forever, and ECMA-402 as consequence, do not consider tags that
+// contain duplicate variants to be structurally valid. This restriction also
+// applies within the |tlang| component (indicating the source locale from which
+// relevant content was transformed) of a broader language tag.
+
+// Direct matches are rejected.
+mustReject("de-t-en-emodeng-emodeng");
+// Case-insensitive matches are also rejected.
+mustReject("de-t-en-Emodeng-emodeng");
+// ...and in either order.
+mustReject("de-t-en-emodeng-Emodeng");
+
+// Repeat the above tests with additional variants interspersed at each point
+// for completeness.
+mustReject("de-t-en-variant-emodeng-emodeng");
+mustReject("de-t-en-variant-Emodeng-emodeng");
+mustReject("de-t-en-variant-emodeng-Emodeng");
+mustReject("de-t-en-emodeng-variant-emodeng");
+mustReject("de-t-en-Emodeng-variant-emodeng");
+mustReject("de-t-en-emodeng-variant-Emodeng");
+mustReject("de-t-en-emodeng-emodeng-variant");
+mustReject("de-t-en-Emodeng-emodeng-variant");
+mustReject("de-t-en-emodeng-Emodeng-variant");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/reject-duplicate-variants.js b/js/src/tests/test262/intl402/Locale/reject-duplicate-variants.js
new file mode 100644
index 0000000000..cb6025388f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/reject-duplicate-variants.js
@@ -0,0 +1,46 @@
+// Copyright 2020 Jeff Walden, Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-isstructurallyvalidlanguagetag
+description: >
+ Verifies that duplicate variants in a tag ("en-emodeng-emodeng") make the tag
+ structurally invalid.
+info: |
+ the `unicode_language_id` within _locale_ contains no duplicate
+ `unicode_variant_subtag` subtags
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(typeof Intl.Locale, "function");
+
+function mustReject(tag) {
+ assert.throws(RangeError, () => {
+ // Direct matches are rejected.
+ new Intl.Locale(tag);
+ }, `tag "${tag}" must be considered structurally invalid`);
+}
+
+// BCP47 since forever, and ECMA-402 as consequence, do not consider tags that
+// contain duplicate variants to be structurally valid.
+
+// Direct matches are rejected.
+mustReject("en-emodeng-emodeng");
+// Case-insensitive matches are also rejected.
+mustReject("en-Emodeng-emodeng");
+// ...and in either order.
+mustReject("en-emodeng-Emodeng");
+
+// Repeat the above tests with additional variants interspersed at each point
+// for completeness.
+mustReject("en-variant-emodeng-emodeng");
+mustReject("en-variant-Emodeng-emodeng");
+mustReject("en-variant-emodeng-Emodeng");
+mustReject("en-emodeng-variant-emodeng");
+mustReject("en-Emodeng-variant-emodeng");
+mustReject("en-emodeng-variant-Emodeng");
+mustReject("en-emodeng-emodeng-variant");
+mustReject("en-Emodeng-emodeng-variant");
+mustReject("en-emodeng-Emodeng-variant");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Locale/shell.js b/js/src/tests/test262/intl402/Locale/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/shell.js
diff --git a/js/src/tests/test262/intl402/Locale/subclassing.js b/js/src/tests/test262/intl402/Locale/subclassing.js
new file mode 100644
index 0000000000..4afc3a5a83
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/subclassing.js
@@ -0,0 +1,28 @@
+// Copyright 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.Locale
+description: Checks that Locale can be subclassed.
+info: |
+ Intl.Locale( tag [, options] )
+
+ 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%, internalSlotsList).
+
+features: [Intl.Locale]
+---*/
+
+class CustomLocale extends Intl.Locale {
+ constructor(locales, options) {
+ super(locales, options);
+ this.isCustom = true;
+ }
+}
+
+var locale = new CustomLocale("de");
+assert.sameValue(locale.isCustom, true, "Custom property");
+assert.sameValue(locale.toString(), "de", "Direct call");
+assert.sameValue(Intl.Locale.prototype.toString.call(locale), "de", "Indirect call");
+assert.sameValue(Object.getPrototypeOf(locale), CustomLocale.prototype, "Prototype");
+
+reportCompare(0, 0);