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