diff options
Diffstat (limited to 'js/src/tests/test262/intl402/Locale/prototype/getTimeZones')
8 files changed, 146 insertions, 0 deletions
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 |