From 2b9b41b7c6d170fd0faa8967bbaa0726c34ec64a Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Mon, 21 Oct 2024 16:22:00 -0700 Subject: [PATCH] Add tests for `Intl.PluralRules.prototype.resolvedOptions().pluralCategories` order Array elements should appear in following order: "zero", "one", "two", "few", "many", "other" see https://github.com/tc39/ecma402/pull/918/ --- .../plural-categories-order.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js diff --git a/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js new file mode 100644 index 00000000000..67ad3d53df7 --- /dev/null +++ b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js @@ -0,0 +1,25 @@ +// Copyright 2024 Igalia S.L. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-intl.pluralrules.prototype.resolvedoptions +description: > + Tests that Intl.PluralRules.prototype.resolvedOptions elements given in correct order. +info: | + Intl.PluralRules.prototype.resolvedOptions () + + 4. Let pluralCategories be a List of Strings containing all possible results of PluralRuleSelect for the selected locale pr.[[Locale]], sorted according to the following order: "zero", "one", "two", "few", "many", "other". + +includes: [compareArray.js] +---*/ + +assert.compareArray(new Intl.PluralRules('ko').resolvedOptions().pluralCategories, ['other']); +assert.compareArray(new Intl.PluralRules('en').resolvedOptions().pluralCategories, ['one', 'other']); +assert.compareArray(new Intl.PluralRules('fa').resolvedOptions().pluralCategories, ['one', 'other']); +assert.compareArray(new Intl.PluralRules('fr').resolvedOptions().pluralCategories, ['one', 'many', 'other'], "pluralCategories order or contents incorrect for 'fr' locale"); +assert.compareArray(new Intl.PluralRules('sl').resolvedOptions().pluralCategories, ['one', 'two', 'few', 'other'], "pluralCategories order or contents incorrect for 'sl' locale"); +assert.compareArray(new Intl.PluralRules('gv').resolvedOptions().pluralCategories, ['one', 'two', 'few', 'many', 'other'], "pluralCategories order or contents incorrect for 'gv' locale"); +assert.compareArray(new Intl.PluralRules('ar').resolvedOptions().pluralCategories, ['zero', 'one', 'two', 'few', 'many', 'other'], "pluralCategories order or contents incorrect for 'ar' locale"); + + +