summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Intl/supportedValuesOf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/intl402/Intl/supportedValuesOf
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/Intl/supportedValuesOf')
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/builtin.js44
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DateTimeFormat.js47
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DisplayNames.js47
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars.js56
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/coerced-to-string.js38
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js83
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/collations.js58
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-DisplayNames.js53
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-NumberFormat.js46
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies.js50
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/invalid-key.js45
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/length.js32
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/name.js34
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-DateTimeFormat.js50
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-NumberFormat.js50
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-RelativeTimeFormat.js50
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-with-simple-digit-mappings.js38
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems.js57
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/prop-desc.js25
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/shell.js24
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js46
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones.js59
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/units-accepted-by-NumberFormat.js47
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/units.js50
25 files changed, 1129 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/browser.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/browser.js
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/builtin.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/builtin.js
new file mode 100644
index 0000000000..8689ef54af
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/builtin.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ Intl.supportedValuesOf is a built-in function object..
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 18 ECMAScript Standard Built-in Objects:
+ Unless specified otherwise, a built-in object that is callable as a function
+ is a built-in function object with the characteristics described in 10.3.
+ Unless specified otherwise, the [[Extensible]] internal slot of a built-in
+ object initially has the value true.
+
+ Unless otherwise specified every built-in function and every built-in
+ constructor has the Function prototype object, which is the initial value
+ of the expression Function.prototype (20.2.3), as the value of its
+ [[Prototype]] internal slot.
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+includes: [isConstructor.js]
+features: [Intl-enumeration, Reflect.construct]
+---*/
+
+assert.sameValue(typeof Intl.supportedValuesOf, "function",
+ "Intl.supportedValuesOf is a function");
+
+assert(!Object.prototype.hasOwnProperty.call(Intl.supportedValuesOf, "prototype"),
+ "Intl.supportedValuesOf doesn't have an own 'prototype' property");
+
+assert(Object.isExtensible(Intl.supportedValuesOf),
+ "Built-in objects must be extensible");
+
+assert.sameValue(Object.getPrototypeOf(Intl.supportedValuesOf), Function.prototype,
+ "[[Prototype]] of Intl.supportedValuesOf is Function.prototype");
+
+assert(!isConstructor(Intl.supportedValuesOf),
+ "Intl.supportedValuesOf not a constructor function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DateTimeFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DateTimeFormat.js
new file mode 100644
index 0000000000..9cbaa39c06
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DateTimeFormat.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "calendar" values can be used with DateTimeFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ 2. If key is "calendar", then
+ a. Let list be ! AvailableCalendars( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCalendars ( )
+ The AvailableCalendars abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique calendar types identifying the
+ calendars for which the implementation provides the functionality of
+ Intl.DateTimeFormat objects. The list must include "gregory".
+includes: [testIntl.js]
+locale: [en]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const calendars = Intl.supportedValuesOf("calendar");
+
+for (let calendar of calendars) {
+ let obj = new Intl.DateTimeFormat("en", {calendar});
+ assert.sameValue(obj.resolvedOptions().calendar, calendar,
+ `${calendar} is supported by DateTimeFormat`);
+}
+
+for (let calendar of allCalendars()) {
+ let obj = new Intl.DateTimeFormat("en", {calendar});
+ if (obj.resolvedOptions().calendar === calendar) {
+ assert(calendars.includes(calendar),
+ `${calendar} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!calendars.includes(calendar),
+ `${calendar} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DisplayNames.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DisplayNames.js
new file mode 100644
index 0000000000..b1c34fd51c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars-accepted-by-DisplayNames.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "calendar" values can be used with DisplayNames.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ 2. If key is "calendar", then
+ a. Let list be ! AvailableCalendars( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCalendars ( )
+ The AvailableCalendars abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique calendar types identifying the
+ calendars for which the implementation provides the functionality of
+ Intl.DateTimeFormat objects. The list must include "gregory".
+includes: [testIntl.js]
+locale: [en]
+features: [Intl-enumeration, Intl.DisplayNames-v2, Array.prototype.includes]
+---*/
+
+const calendars = Intl.supportedValuesOf("calendar");
+
+const obj = new Intl.DisplayNames("en", {type: "calendar", fallback: "none"});
+
+for (let calendar of calendars) {
+ assert.sameValue(typeof obj.of(calendar), "string",
+ `${calendar} is supported by DisplayNames`);
+}
+
+for (let calendar of allCalendars()) {
+ if (typeof obj.of(calendar) === "string") {
+ assert(calendars.includes(calendar),
+ `${calendar} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!calendars.includes(calendar),
+ `${calendar} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars.js
new file mode 100644
index 0000000000..4de1a5e689
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/calendars.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "calendar" values are sorted, unique, and match the type production.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ 2. If key is "calendar", then
+ a. Let list be ! AvailableCalendars( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCalendars ( )
+ The AvailableCalendars abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique calendar types identifying the
+ calendars for which the implementation provides the functionality of
+ Intl.DateTimeFormat objects. The list must include "gregory".
+includes: [compareArray.js]
+features: [Intl-enumeration, Intl.Locale, Array.prototype.includes]
+---*/
+
+const calendars = Intl.supportedValuesOf("calendar");
+
+assert(Array.isArray(calendars), "Returns an Array object.");
+assert.sameValue(Object.getPrototypeOf(calendars), Array.prototype,
+ "The array prototype is Array.prototype");
+
+const otherCalendars = Intl.supportedValuesOf("calendar");
+assert.notSameValue(otherCalendars, calendars,
+ "Returns a new array object for each call.");
+
+assert.compareArray(calendars, otherCalendars.sort(),
+ "The array is sorted.");
+
+assert.sameValue(new Set(calendars).size, calendars.length,
+ "The array doesn't contain duplicates.");
+
+// https://unicode.org/reports/tr35/tr35.html#Unicode_locale_identifier
+const typeRE = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/;
+for (let calendar of calendars) {
+ assert(typeRE.test(calendar), `${calendar} matches the 'type' production`);
+}
+
+for (let calendar of calendars) {
+ assert.sameValue(new Intl.Locale("und", {calendar}).calendar, calendar,
+ `${calendar} is canonicalised`);
+}
+
+assert(calendars.includes("gregory"), "Includes the Gregorian calendar.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/coerced-to-string.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/coerced-to-string.js
new file mode 100644
index 0000000000..b5354265b9
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/coerced-to-string.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ Input key is coerced with ToString.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ 2. If key is "calendar", then
+ a. Let list be ! AvailableCalendars( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+includes: [compareArray.js]
+features: [Intl-enumeration]
+---*/
+
+const calendars = Intl.supportedValuesOf("calendar");
+
+// ToString on a String object.
+assert.compareArray(Intl.supportedValuesOf(new String("calendar")), calendars);
+
+// ToString on a plain object.
+let obj = {
+ toString() {
+ return "calendar";
+ }
+};
+assert.compareArray(Intl.supportedValuesOf(obj), calendars);
+
+// ToString() of a symbol throws a TypeError.
+assert.throws(TypeError, function() {
+ Intl.supportedValuesOf(Symbol());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js
new file mode 100644
index 0000000000..ee4413581b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js
@@ -0,0 +1,83 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "collation" values can be used with Collator.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 3. Else if key is "collation", then
+ a. Let list be ! AvailableCollations( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCollations ( )
+ The AvailableCollations abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique collation types identifying the
+ collations for which the implementation provides the functionality of
+ Intl.Collator objects.
+includes: [testIntl.js]
+locale: [en, ar, de, es, ko, ln, si, sv, zh]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const collations = Intl.supportedValuesOf("collation");
+
+// Not all locales support all possible collations, so test the minimal set to
+// cover all supported collations.
+//
+// The list of all collations can be derived from
+// <https://github.com/unicode-org/cldr/blob/master/common/bcp47/collation.xml>.
+//
+// Note: "standard" and "search" are explicitly disallowed by Intl.Collator.
+const locales = [
+ "en", // ducet, emoji, eor
+ "ar", // compat
+ "de", // phonebk
+ "es", // trad
+ "hi", // direct
+ "ko", // searchjl
+ "ln", // phonetic
+ "si", // dict
+ "sv", // reformed
+ "zh", // big5han, gb2312, pinyin, stroke, unihan, zhuyin
+];
+
+for (let collation of collations) {
+ let supported = false;
+ for (let locale of locales) {
+ let obj = new Intl.Collator(locale, {collation});
+ if (obj.resolvedOptions().collation === collation) {
+ supported = true;
+ break;
+ }
+ }
+
+ assert(supported, `${collation} is supported by Collator`);
+}
+
+for (let collation of allCollations()) {
+ let supported = false;
+ for (let locale of locales) {
+ let obj = new Intl.Collator(locale, {collation});
+ if (obj.resolvedOptions().collation === collation) {
+ supported = true;
+ break;
+ }
+ }
+
+ if (supported) {
+ assert(collations.includes(collation),
+ `${collation} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!collations.includes(collation),
+ `${collation} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/collations.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/collations.js
new file mode 100644
index 0000000000..372f84c7bf
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/collations.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "collation" values are sorted, unique, and match the type production.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 3. Else if key is "collation", then
+ a. Let list be ! AvailableCollations( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCollations ( )
+ The AvailableCollations abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique collation types identifying the
+ collations for which the implementation provides the functionality of
+ Intl.Collator objects.
+includes: [compareArray.js]
+features: [Intl-enumeration, Intl.Locale, Array.prototype.includes]
+---*/
+
+const collations = Intl.supportedValuesOf("collation");
+
+assert(Array.isArray(collations), "Returns an Array object.");
+assert.sameValue(Object.getPrototypeOf(collations), Array.prototype,
+ "The array prototype is Array.prototype");
+
+const otherCollations = Intl.supportedValuesOf("collation");
+assert.notSameValue(otherCollations, collations,
+ "Returns a new array object for each call.");
+
+assert.compareArray(collations, otherCollations.sort(),
+ "The array is sorted.");
+
+assert.sameValue(new Set(collations).size, collations.length,
+ "The array doesn't contain duplicates.");
+
+// https://unicode.org/reports/tr35/tr35.html#Unicode_locale_identifier
+const typeRE = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/;
+for (let collation of collations) {
+ assert(typeRE.test(collation), `${collation} matches the 'type' production`);
+}
+
+for (let collation of collations) {
+ assert.sameValue(new Intl.Locale("und", {collation}).collation, collation,
+ `${collation} is canonicalised`);
+}
+
+assert(!collations.includes("standard"), "Mustn't include the 'standard' collation type.");
+assert(!collations.includes("search"), "Mustn't include the 'search' collation type.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-DisplayNames.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-DisplayNames.js
new file mode 100644
index 0000000000..cccc756b9f
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-DisplayNames.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "currency" values can be used with DisplayNames.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 4. Else if key is "currency", then
+ a. Let list be ! AvailableCurrencies( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCurrencies ( )
+ The AvailableCurrencies abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique, well-formed, and upper case
+ canonicalized 3-letter ISO 4217 currency codes, identifying the currencies
+ for which the implementation provides the functionality of Intl.DisplayNames
+ and Intl.NumberFormat objects.
+locale: [en]
+features: [Intl-enumeration, Intl.DisplayNames, Array.prototype.includes]
+---*/
+
+const currencies = Intl.supportedValuesOf("currency");
+
+const obj = new Intl.DisplayNames("en", {type: "currency", fallback: "none"});
+
+for (let currency of currencies) {
+ assert.sameValue(typeof obj.of(currency), "string",
+ `${currency} is supported by DisplayNames`);
+}
+
+for (let i = 0x41; i <= 0x5A; ++i) {
+ for (let j = 0x41; j <= 0x5A; ++j) {
+ for (let k = 0x41; k <= 0x5A; ++k) {
+ let currency = String.fromCharCode(i, j, k);
+ if (typeof obj.of(currency) === "string") {
+ assert(currencies.includes(currency),
+ `${currency} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!currencies.includes(currency),
+ `${currency} not supported but returned by supportedValuesOf`);
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-NumberFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-NumberFormat.js
new file mode 100644
index 0000000000..089d0dd322
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies-accepted-by-NumberFormat.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "currency" values can be used with NumberFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 4. Else if key is "currency", then
+ a. Let list be ! AvailableCurrencies( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCurrencies ( )
+ The AvailableCurrencies abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique, well-formed, and upper case
+ canonicalized 3-letter ISO 4217 currency codes, identifying the currencies
+ for which the implementation provides the functionality of Intl.DisplayNames
+ and Intl.NumberFormat objects.
+locale: [en]
+features: [Intl-enumeration]
+---*/
+
+const currencies = Intl.supportedValuesOf("currency");
+
+for (let currency of currencies) {
+ let obj = new Intl.NumberFormat("en", {style: "currency", currency});
+ assert.sameValue(obj.resolvedOptions().currency, currency,
+ `${currency} is supported by NumberFormat`);
+}
+
+// Note: We can't test that additional currency values not present in |currencies|
+// aren't supported by Intl.NumberFormat, because PartitionNumberPattern defaults
+// to using the currency code itself when the currency is unsupported:
+//
+// PartitionNumberPattern, step 8.k.iii:
+// Let cd be an ILD String value representing currency after x in currencyDisplay form,
+// which may depend on x in languages having different plural forms. If the
+// implementation does not have such a representation of currency, use currency itself.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies.js
new file mode 100644
index 0000000000..467ee39ca1
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/currencies.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "currency" values are sorted, unique, and upper-case canonicalised.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 4. Else if key is "currency", then
+ a. Let list be ! AvailableCurrencies( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableCurrencies ( )
+ The AvailableCurrencies abstract operation returns a List, ordered as if an
+ Array of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains unique, well-formed, and upper case
+ canonicalized 3-letter ISO 4217 currency codes, identifying the currencies
+ for which the implementation provides the functionality of Intl.DisplayNames
+ and Intl.NumberFormat objects.
+includes: [compareArray.js]
+features: [Intl-enumeration]
+---*/
+
+const currencies = Intl.supportedValuesOf("currency");
+
+assert(Array.isArray(currencies), "Returns an Array object.");
+assert.sameValue(Object.getPrototypeOf(currencies), Array.prototype,
+ "The array prototype is Array.prototype");
+
+const otherCurrencies = Intl.supportedValuesOf("currency");
+assert.notSameValue(otherCurrencies, currencies,
+ "Returns a new array object for each call.");
+
+assert.compareArray(currencies, otherCurrencies.sort(),
+ "The array is sorted.");
+
+assert.sameValue(new Set(currencies).size, currencies.length,
+ "The array doesn't contain duplicates.");
+
+const codeRE = /^[A-Z]{3}$/;
+for (let currency of currencies) {
+ assert(codeRE.test(currency), `${currency} is a 3-letter ISO 4217 currency code`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/invalid-key.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/invalid-key.js
new file mode 100644
index 0000000000..07202b4b5d
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/invalid-key.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ Intl.supportedValuesOf throws a RangeError if the key is invalid.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 8. Else,
+ a. Throw a RangeError exception.
+ ...
+features: [Intl-enumeration]
+---*/
+
+const invalidKeys = [
+ // Empty string is invalid.
+ "",
+
+ // Various unsupported keys.
+ "hourCycle", "locale", "language", "script", "region",
+
+ // Plural form of supported keys not valid.
+ "calendars", "collations", "currencies", "numberingSystems", "timeZones", "units",
+
+ // Wrong case for supported keys.
+ "CALENDAR", "Collation", "Currency", "numberingsystem", "timezone", "UNIT",
+
+ // NUL character must be handled correctly.
+ "calendar\0",
+
+ // Non-string cases.
+ undefined, null, false, true, NaN, 0, Math.PI, 123n, {}, [],
+];
+
+for (let key of invalidKeys) {
+ assert.throws(RangeError, function() {
+ Intl.supportedValuesOf(key);
+ }, "key: " + key);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/length.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/length.js
new file mode 100644
index 0000000000..39a5d577f0
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ Intl.supportedValuesOf.length value and descriptor.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 18 ECMAScript Standard Built-in Objects:
+ Every built-in function object, including constructors, has a "length"
+ property whose value is a non-negative integral Number. Unless otherwise
+ specified, this value is equal to the number of required parameters shown in
+ the subclause heading for the function description. Optional parameters and
+ rest parameters are not included in the parameter 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-enumeration]
+---*/
+
+verifyProperty(Intl.supportedValuesOf, "length", {
+ value: 1,
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/name.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/name.js
new file mode 100644
index 0000000000..c8838bb249
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/name.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ Intl.supportedValuesOf.name value and descriptor.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 18 ECMAScript Standard Built-in Objects:
+ Every built-in function object, including constructors, 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 identified as anonymous functions use the empty String as the value of
+ the "name" property. For functions that are specified as properties of
+ objects, the name value is the property name string used to access the
+ function.
+
+ Unless otherwise specified, the "name" property of a built-in function object
+ has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl-enumeration]
+---*/
+
+verifyProperty(Intl.supportedValuesOf, "name", {
+ value: "supportedValuesOf",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-DateTimeFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-DateTimeFormat.js
new file mode 100644
index 0000000000..71c89eaa97
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-DateTimeFormat.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "numberingSystem" values can be used with DateTimeFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 5. Else if key is "numberingSystem", then
+ a. Let list be ! AvailableNumberingSystems( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableNumberingSystems ( )
+ The AvailableNumberingSystems abstract operation returns a List, ordered as
+ if an Array of the same values had been sorted using %Array.prototype.sort%
+ using undefined as comparefn, that contains unique numbering systems
+ identifiers identifying the numbering systems for which the implementation
+ provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and
+ Intl.RelativeTimeFormat objects. The list must include the Numbering System
+ value of every row of Table 4, except the header row.
+includes: [testIntl.js]
+locale: [en]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const numberingSystems = Intl.supportedValuesOf("numberingSystem");
+
+for (let numberingSystem of numberingSystems) {
+ let obj = new Intl.DateTimeFormat("en", {numberingSystem});
+ assert.sameValue(obj.resolvedOptions().numberingSystem, numberingSystem,
+ `${numberingSystem} is supported by DateTimeFormat`);
+}
+
+for (let numberingSystem of allNumberingSystems()) {
+ let obj = new Intl.DateTimeFormat("en", {numberingSystem});
+ if (obj.resolvedOptions().numberingSystem === numberingSystem) {
+ assert(numberingSystems.includes(numberingSystem),
+ `${numberingSystem} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!numberingSystems.includes(numberingSystem),
+ `${numberingSystem} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-NumberFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-NumberFormat.js
new file mode 100644
index 0000000000..877d28368c
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-NumberFormat.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "numberingSystem" values can be used with NumberFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 5. Else if key is "numberingSystem", then
+ a. Let list be ! AvailableNumberingSystems( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableNumberingSystems ( )
+ The AvailableNumberingSystems abstract operation returns a List, ordered as
+ if an Array of the same values had been sorted using %Array.prototype.sort%
+ using undefined as comparefn, that contains unique numbering systems
+ identifiers identifying the numbering systems for which the implementation
+ provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and
+ Intl.RelativeTimeFormat objects. The list must include the Numbering System
+ value of every row of Table 4, except the header row.
+includes: [testIntl.js]
+locale: [en]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const numberingSystems = Intl.supportedValuesOf("numberingSystem");
+
+for (let numberingSystem of numberingSystems) {
+ let obj = new Intl.NumberFormat("en", {numberingSystem});
+ assert.sameValue(obj.resolvedOptions().numberingSystem, numberingSystem,
+ `${numberingSystem} is supported by NumberFormat`);
+}
+
+for (let numberingSystem of allNumberingSystems()) {
+ let obj = new Intl.NumberFormat("en", {numberingSystem});
+ if (obj.resolvedOptions().numberingSystem === numberingSystem) {
+ assert(numberingSystems.includes(numberingSystem),
+ `${numberingSystem} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!numberingSystems.includes(numberingSystem),
+ `${numberingSystem} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-RelativeTimeFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-RelativeTimeFormat.js
new file mode 100644
index 0000000000..423a3ae3dc
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-RelativeTimeFormat.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "numberingSystem" values can be used with RelativeTimeFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 5. Else if key is "numberingSystem", then
+ a. Let list be ! AvailableNumberingSystems( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableNumberingSystems ( )
+ The AvailableNumberingSystems abstract operation returns a List, ordered as
+ if an Array of the same values had been sorted using %Array.prototype.sort%
+ using undefined as comparefn, that contains unique numbering systems
+ identifiers identifying the numbering systems for which the implementation
+ provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and
+ Intl.RelativeTimeFormat objects. The list must include the Numbering System
+ value of every row of Table 4, except the header row.
+includes: [testIntl.js]
+locale: [en]
+features: [Intl-enumeration, Intl.RelativeTimeFormat, Array.prototype.includes]
+---*/
+
+const numberingSystems = Intl.supportedValuesOf("numberingSystem");
+
+for (let numberingSystem of numberingSystems) {
+ let obj = new Intl.RelativeTimeFormat("en", {numberingSystem});
+ assert.sameValue(obj.resolvedOptions().numberingSystem, numberingSystem,
+ `${numberingSystem} is supported by RelativeTimeFormat`);
+}
+
+for (let numberingSystem of allNumberingSystems()) {
+ let obj = new Intl.RelativeTimeFormat("en", {numberingSystem});
+ if (obj.resolvedOptions().numberingSystem === numberingSystem) {
+ assert(numberingSystems.includes(numberingSystem),
+ `${numberingSystem} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!numberingSystems.includes(numberingSystem),
+ `${numberingSystem} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-with-simple-digit-mappings.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-with-simple-digit-mappings.js
new file mode 100644
index 0000000000..0ff107c350
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems-with-simple-digit-mappings.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "numberingSystem" values contain all numbering systems with simple digit mappings.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 5. Else if key is "numberingSystem", then
+ a. Let list be ! AvailableNumberingSystems( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableNumberingSystems ( )
+ The AvailableNumberingSystems abstract operation returns a List, ordered as
+ if an Array of the same values had been sorted using %Array.prototype.sort%
+ using undefined as comparefn, that contains unique numbering systems
+ identifiers identifying the numbering systems for which the implementation
+ provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and
+ Intl.RelativeTimeFormat objects. The list must include the Numbering System
+ value of every row of Table 4, except the header row.
+includes: [testIntl.js]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const numberingSystems = Intl.supportedValuesOf("numberingSystem");
+
+// Table 10: Numbering systems with simple digit mappings
+for (let numberingSystem of Object.keys(numberingSystemDigits)) {
+ assert(numberingSystems.includes(numberingSystem),
+ `${numberingSystem} with simple digit mappings is supported`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems.js
new file mode 100644
index 0000000000..cb02432cd7
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/numberingSystems.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "numberingSystem" values are sorted, unique, and match the type production.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 5. Else if key is "numberingSystem", then
+ a. Let list be ! AvailableNumberingSystems( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableNumberingSystems ( )
+ The AvailableNumberingSystems abstract operation returns a List, ordered as
+ if an Array of the same values had been sorted using %Array.prototype.sort%
+ using undefined as comparefn, that contains unique numbering systems
+ identifiers identifying the numbering systems for which the implementation
+ provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and
+ Intl.RelativeTimeFormat objects. The list must include the Numbering System
+ value of every row of Table 4, except the header row.
+includes: [compareArray.js]
+features: [Intl-enumeration, Intl.Locale]
+---*/
+
+const numberingSystems = Intl.supportedValuesOf("numberingSystem");
+
+assert(Array.isArray(numberingSystems), "Returns an Array object.");
+assert.sameValue(Object.getPrototypeOf(numberingSystems), Array.prototype,
+ "The array prototype is Array.prototype");
+
+const otherNumberingSystems = Intl.supportedValuesOf("numberingSystem");
+assert.notSameValue(otherNumberingSystems, numberingSystems,
+ "Returns a new array object for each call.");
+
+assert.compareArray(numberingSystems, otherNumberingSystems.sort(),
+ "The array is sorted.");
+
+assert.sameValue(new Set(numberingSystems).size, numberingSystems.length,
+ "The array doesn't contain duplicates.");
+
+// https://unicode.org/reports/tr35/tr35.html#Unicode_locale_identifier
+const typeRE = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/;
+for (let numberingSystem of numberingSystems) {
+ assert(typeRE.test(numberingSystem), `${numberingSystem} matches the 'type' production`);
+}
+
+for (let numberingSystem of numberingSystems) {
+ assert.sameValue(new Intl.Locale("und", {numberingSystem}).numberingSystem, numberingSystem,
+ `${numberingSystem} is canonicalised`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/prop-desc.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/prop-desc.js
new file mode 100644
index 0000000000..5722b8f3ac
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/prop-desc.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ Intl.supportedValuesOf property attributes.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 18 ECMAScript Standard Built-in Objects:
+ Every other data property described in clauses 19 through 28 and in Annex B.2
+ has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+features: [Intl-enumeration]
+---*/
+
+verifyProperty(Intl, "supportedValuesOf", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/shell.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/shell.js
@@ -0,0 +1,24 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js
new file mode 100644
index 0000000000..b2be51b737
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "timeZone" values can be used with DateTimeFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 6. Else if key is "timeZone", then
+ a. Let list be ! AvailableTimeZones( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableTimeZones ()
+ The AvailableTimeZones abstract operation returns a sorted List of supported
+ Zone and Link names in the IANA Time Zone Database. The following steps are
+ taken:
+
+ 1. Let names be a List of all supported Zone and Link names in the IANA Time
+ Zone Database.
+ 2. Let result be a new empty List.
+ 3. For each element name of names, do
+ a. Assert: ! IsValidTimeZoneName( name ) is true.
+ b. Let canonical be ! CanonicalizeTimeZoneName( name ).
+ c. If result does not contain an element equal to canonical, then
+ i. Append canonical to the end of result.
+ 4. Sort result in order as if an Array of the same values had been sorted using
+ %Array.prototype.sort% using undefined as comparefn.
+ 5. Return result.
+locale: [en]
+features: [Intl-enumeration]
+---*/
+
+const timeZones = Intl.supportedValuesOf("timeZone");
+
+for (let timeZone of timeZones) {
+ let obj = new Intl.DateTimeFormat("en", {timeZone});
+ assert.sameValue(obj.resolvedOptions().timeZone, timeZone,
+ `${timeZone} is supported by DateTimeFormat`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones.js
new file mode 100644
index 0000000000..0f12d4c9e4
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "timeZone" values are sorted, unique, and canonicalised.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 6. Else if key is "timeZone", then
+ a. Let list be ! AvailableTimeZones( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableTimeZones ()
+ The AvailableTimeZones abstract operation returns a sorted List of supported
+ Zone and Link names in the IANA Time Zone Database. The following steps are
+ taken:
+
+ 1. Let names be a List of all supported Zone and Link names in the IANA Time
+ Zone Database.
+ 2. Let result be a new empty List.
+ 3. For each element name of names, do
+ a. Assert: ! IsValidTimeZoneName( name ) is true.
+ b. Let canonical be ! CanonicalizeTimeZoneName( name ).
+ c. If result does not contain an element equal to canonical, then
+ i. Append canonical to the end of result.
+ 4. Sort result in order as if an Array of the same values had been sorted using
+ %Array.prototype.sort% using undefined as comparefn.
+ 5. Return result.
+includes: [compareArray.js, testIntl.js]
+features: [Intl-enumeration]
+---*/
+
+const timeZones = Intl.supportedValuesOf("timeZone");
+
+assert(Array.isArray(timeZones), "Returns an Array object.");
+assert.sameValue(Object.getPrototypeOf(timeZones), Array.prototype,
+ "The array prototype is Array.prototype");
+
+const otherTimeZones = Intl.supportedValuesOf("timeZone");
+assert.notSameValue(otherTimeZones, timeZones,
+ "Returns a new array object for each call.");
+
+assert.compareArray(timeZones, otherTimeZones.sort(),
+ "The array is sorted.");
+
+assert.sameValue(new Set(timeZones).size, timeZones.length,
+ "The array doesn't contain duplicates.");
+
+for (let timeZone of timeZones) {
+ assert(isCanonicalizedStructurallyValidTimeZoneName(timeZone),
+ `${timeZone} is a canonicalised and structurally valid time zone name`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/units-accepted-by-NumberFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/units-accepted-by-NumberFormat.js
new file mode 100644
index 0000000000..0132f569b2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/units-accepted-by-NumberFormat.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "unit" values can be used with NumberFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 7. Else if key is "unit", then
+ a. Let list be ! AvailableUnits( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableUnits ( )
+ The AvailableUnits abstract operation returns a List, ordered as if an Array
+ of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains the unique values of simple unit
+ identifiers listed in every row of Table 1, except the header row.
+includes: [testIntl.js]
+locale: [en]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const units = Intl.supportedValuesOf("unit");
+
+for (let unit of units) {
+ let obj = new Intl.NumberFormat("en", {style: "unit", unit});
+ assert.sameValue(obj.resolvedOptions().unit, unit,
+ `${unit} is supported by NumberFormat`);
+}
+
+for (let unit of allSimpleSanctionedUnits()) {
+ let obj = new Intl.NumberFormat("en", {style: "unit", unit});
+ if (obj.resolvedOptions().unit === unit) {
+ assert(units.includes(unit),
+ `${unit} supported but not returned by supportedValuesOf`);
+ } else {
+ assert(!units.includes(unit),
+ `${unit} not supported but returned by supportedValuesOf`);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/units.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/units.js
new file mode 100644
index 0000000000..9f1084bdf0
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/units.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "unit" values are sorted, unique, and well-formed.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 7. Else if key is "unit", then
+ a. Let list be ! AvailableUnits( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableUnits ( )
+ The AvailableUnits abstract operation returns a List, ordered as if an Array
+ of the same values had been sorted using %Array.prototype.sort% using
+ undefined as comparefn, that contains the unique values of simple unit
+ identifiers listed in every row of Table 1, except the header row.
+includes: [compareArray.js, testIntl.js]
+features: [Intl-enumeration, Array.prototype.includes]
+---*/
+
+const units = Intl.supportedValuesOf("unit");
+
+assert(Array.isArray(units), "Returns an Array object.");
+assert.sameValue(Object.getPrototypeOf(units), Array.prototype,
+ "The array prototype is Array.prototype");
+
+const otherUnits = Intl.supportedValuesOf("unit");
+assert.notSameValue(otherUnits, units,
+ "Returns a new array object for each call.");
+
+assert.compareArray(units, otherUnits.sort(),
+ "The array is sorted.");
+
+assert.sameValue(new Set(units).size, units.length,
+ "The array doesn't contain duplicates.");
+
+const simpleSanctioned = allSimpleSanctionedUnits();
+
+for (let unit of units) {
+ assert(simpleSanctioned.includes(unit), `${unit} is a simple, sanctioned unit`);
+ assert(!unit.includes("-per-"), `${unit} isn't a compound unit`);
+}
+
+reportCompare(0, 0);