From 18e3e85c4b09dd41cd2381f7ba1c9d4acc7d3040 Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Mon, 21 Oct 2024 16:22:00 -0700 Subject: [PATCH 1/3] 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 | 26 +++++++++++++++++++ 1 file changed, 26 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..7e1659c7d57 --- /dev/null +++ b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js @@ -0,0 +1,26 @@ +// 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'], "pluralCategories order or contents incorrect for 'ko' locale"); + +assert.compareArray(new Intl.PluralRules('en').resolvedOptions().pluralCategories, ['one', 'other'], "pluralCategories order or contents incorrect for 'en' locale"); +assert.compareArray(new Intl.PluralRules('fa').resolvedOptions().pluralCategories, ['one', 'other'], "pluralCategories order or contents incorrect for 'fa' locale"); +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"); + + + From 4641f37ff9bf57781bd42c42d29c7ec207e76388 Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Fri, 1 Nov 2024 10:31:51 -0700 Subject: [PATCH 2/3] fixup! Add tests for `Intl.PluralRules.prototype.resolvedOptions().pluralCategories` order --- .../resolvedOptions/plural-categories-order.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js index 7e1659c7d57..3f3cbf9fc34 100644 --- a/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js +++ b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js @@ -11,16 +11,14 @@ info: | 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] +locale: [ar, en, fa, fr, gv, ko, sl] ---*/ -assert.compareArray(new Intl.PluralRules('ko').resolvedOptions().pluralCategories, ['other'], "pluralCategories order or contents incorrect for 'ko' locale"); - +assert.compareArray(new Intl.PluralRules('ar').resolvedOptions().pluralCategories, ['zero', 'one', 'two', 'few', 'many', 'other'], "pluralCategories order or contents incorrect for 'ar' locale"); assert.compareArray(new Intl.PluralRules('en').resolvedOptions().pluralCategories, ['one', 'other'], "pluralCategories order or contents incorrect for 'en' locale"); assert.compareArray(new Intl.PluralRules('fa').resolvedOptions().pluralCategories, ['one', 'other'], "pluralCategories order or contents incorrect for 'fa' locale"); 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"); - - +assert.compareArray(new Intl.PluralRules('ko').resolvedOptions().pluralCategories, ['other'], "pluralCategories order or contents incorrect for 'ko' locale"); +assert.compareArray(new Intl.PluralRules('sl').resolvedOptions().pluralCategories, ['one', 'two', 'few', 'other'], "pluralCategories order or contents incorrect for 'sl' locale"); From 8c9180eb2f84db4fc92580e9fa3b7fca5b8659a4 Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Mon, 4 Nov 2024 10:49:16 -0800 Subject: [PATCH 3/3] fixup! fixup! Add tests for `Intl.PluralRules.prototype.resolvedOptions().pluralCategories` order --- .../prototype/resolvedOptions/plural-categories-order.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js index 3f3cbf9fc34..f6fcc8a84e4 100644 --- a/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js +++ b/test/intl402/PluralRules/prototype/resolvedOptions/plural-categories-order.js @@ -20,5 +20,4 @@ assert.compareArray(new Intl.PluralRules('fa').resolvedOptions().pluralCategorie assert.compareArray(new Intl.PluralRules('fr').resolvedOptions().pluralCategories, ['one', 'many', 'other'], "pluralCategories order or contents incorrect for 'fr' 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('ko').resolvedOptions().pluralCategories, ['other'], "pluralCategories order or contents incorrect for 'ko' locale"); - assert.compareArray(new Intl.PluralRules('sl').resolvedOptions().pluralCategories, ['one', 'two', 'few', 'other'], "pluralCategories order or contents incorrect for 'sl' locale");