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