diff options
Diffstat (limited to 'js/src/tests/test262/intl402/PluralRules/supportedLocalesOf')
8 files changed, 170 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/arguments.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/arguments.js new file mode 100644 index 0000000000..bf6e487d6e --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/arguments.js @@ -0,0 +1,16 @@ +// Copyright 2016 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-Intl.PluralRules.supportedLocalesOf +description: > + Tests that Intl.PluralRules.supportedLocalesOf doesn't access + arguments that it's not given. +author: Zibi Braniecki +includes: [testIntl.js] +---*/ + +taintDataProperty(Object.prototype, "1"); +new Intl.PluralRules("und"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/browser.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/browser.js diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/length.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/length.js new file mode 100644 index 0000000000..6192952f33 --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/length.js @@ -0,0 +1,33 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.pluralrules.supportedlocalesof +description: > + Intl.PluralRules.supportedLocalesOf.length is 1. +info: | + Intl.PluralRules.supportedLocalesOf ( locales [ , options ] ) + + 17 ECMAScript Standard Built-in Objects: + + 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] +---*/ + +assert.sameValue(Intl.PluralRules.supportedLocalesOf.length, 1); + +verifyNotEnumerable(Intl.PluralRules.supportedLocalesOf, "length"); +verifyNotWritable(Intl.PluralRules.supportedLocalesOf, "length"); +verifyConfigurable(Intl.PluralRules.supportedLocalesOf, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/main.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/main.js new file mode 100644 index 0000000000..23afcb1099 --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/main.js @@ -0,0 +1,25 @@ +// Copyright 2016 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-Intl.PluralRules.supportedLocalesOf +description: > + Tests that Intl.PluralRules has a supportedLocalesOf property, and + it works as planned. +author: Zibi Braniecki +---*/ + +var defaultLocale = new Intl.PluralRules().resolvedOptions().locale; +var notSupported = 'zxx'; // "no linguistic content" +var requestedLocales = [defaultLocale, notSupported]; + +var supportedLocales; + +assert(Intl.PluralRules.hasOwnProperty('supportedLocalesOf'), "Intl.PluralRules doesn't have a supportedLocalesOf property."); + +supportedLocales = Intl.PluralRules.supportedLocalesOf(requestedLocales); +assert.sameValue(supportedLocales.length, 1, 'The length of supported locales list is not 1.'); + +assert.sameValue(supportedLocales[0], defaultLocale, 'The default locale is not returned in the supported list.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/name.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/name.js new file mode 100644 index 0000000000..a79e9180be --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/name.js @@ -0,0 +1,16 @@ +// Copyright 2016 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-Intl.PluralRules.supportedLocalesOf +description: Tests that Intl.PluralRules.supportedLocalesOf.name is "supportedLocalesOf" +author: Zibi Braniecki +includes: [propertyHelper.js] +---*/ +assert.sameValue(Intl.PluralRules.supportedLocalesOf.name, "supportedLocalesOf"); + +verifyNotEnumerable(Intl.PluralRules.supportedLocalesOf, "name"); +verifyNotWritable(Intl.PluralRules.supportedLocalesOf, "name"); +verifyConfigurable(Intl.PluralRules.supportedLocalesOf, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/prop-desc.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/prop-desc.js new file mode 100644 index 0000000000..ac8a8d5ba3 --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/prop-desc.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.pluralrules.supportedlocalesof +description: > + "supportedLocalesOf" property of Intl.PluralRules. +info: | + Intl.PluralRules.supportedLocalesOf ( locales [ , options ] ) + + 7 Requirements for Standard Built-in ECMAScript Objects + + Unless specified otherwise in this document, the objects, functions, and constructors + described in this standard are subject to the generic requirements and restrictions + specified for standard built-in ECMAScript objects in the ECMAScript 2018 Language + Specification, 9th edition, clause 17, or successor. + + 17 ECMAScript Standard Built-in Objects: + + Every other data property described in clauses 18 through 26 and in Annex B.2 has the + attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } + unless otherwise specified. + +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Intl.PluralRules, "supportedLocalesOf"); +verifyWritable(Intl.PluralRules, "supportedLocalesOf"); +verifyConfigurable(Intl.PluralRules, "supportedLocalesOf"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/shell.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/shell.js new file mode 100644 index 0000000000..54371b7789 --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/shell.js @@ -0,0 +1,19 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +---*/ + +function isConstructor(f) { + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js new file mode 100644 index 0000000000..1bff8cdb1c --- /dev/null +++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js @@ -0,0 +1,30 @@ +// Copyright 2016 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-Intl.PluralRules.supportedLocalesOf +description: > + Tests that Intl.PluralRules.supportedLocalesOf meets the requirements for + built-in objects defined by the introduction of chapter 17 of the + ECMAScript Language Specification. +author: Zibi Braniecki +includes: [isConstructor.js] +features: [Reflect.construct] +---*/ + +assert.sameValue(Object.prototype.toString.call(Intl.PluralRules.supportedLocalesOf), "[object Function]", + "The [[Class]] internal property of a built-in function must be " + + "\"Function\"."); + +assert(Object.isExtensible(Intl.PluralRules.supportedLocalesOf), + "Built-in objects must be extensible."); + +assert.sameValue(Object.getPrototypeOf(Intl.PluralRules.supportedLocalesOf), Function.prototype); + +assert.sameValue(Intl.PluralRules.supportedLocalesOf.hasOwnProperty("prototype"), false, + "Built-in functions that aren't constructors must not have a prototype property."); + +assert.sameValue(isConstructor(Intl.PluralRules.supportedLocalesOf), false, + "Built-in functions don't implement [[Construct]] unless explicitly specified."); + +reportCompare(0, 0); |