Skip to content
Snippets Groups Projects
Commit 3c94ba01 authored by Valerie R Young's avatar Valerie R Young
Browse files

Fixup of 'Add version of intl402/6.2.3.js...'

parent 19caba81
No related branches found
No related tags found
No related merge requests found
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es5id: 6.2.3 esid: intl.getcanonicallocales
description: Tests that language tags are canonicalized in return values. description: Tests the getCanonicalLocales for locale tags.
author: Norbert Lindenberg info: >
includes: [testIntl.js] Intl.getCanonicalLocales (locales)
1. Let ll be ? CanonicalizeLocaleList(locales).
2. Return CreateArrayFromList(ll).
---*/ ---*/
var canonicalizedTags = { var canonicalizedTags = {
...@@ -19,7 +21,6 @@ var canonicalizedTags = { ...@@ -19,7 +21,6 @@ var canonicalizedTags = {
"cmn-hans-cn": ["cmn-Hans-CN", "cmn-Hans", "cmn"], "cmn-hans-cn": ["cmn-Hans-CN", "cmn-Hans", "cmn"],
"es-419": ["es-419", "es"], "es-419": ["es-419", "es"],
"es-419-u-nu-latn": ["es-419-u-nu-latn", "es-419", "es", "es-u-nu-latn"], "es-419-u-nu-latn": ["es-419-u-nu-latn", "es-419", "es", "es-u-nu-latn"],
// -u-ca is incomplete, so it will not show up in resolvedOptions().locale
"cmn-hans-cn-u-ca-t-ca-x-t-u": ["cmn-Hans-CN-t-ca-u-ca-x-t-u", "cmn-Hans-CN-t-ca-x-t-u", "cmn-Hans-CN-t-ca-x-t", "cmn-Hans-CN-t-ca", "cmn-Hans-CN", "cmn-Hans", "cmn"], "cmn-hans-cn-u-ca-t-ca-x-t-u": ["cmn-Hans-CN-t-ca-u-ca-x-t-u", "cmn-Hans-CN-t-ca-x-t-u", "cmn-Hans-CN-t-ca-x-t", "cmn-Hans-CN-t-ca", "cmn-Hans-CN", "cmn-Hans", "cmn"],
"de-gregory-u-ca-gregory": ["de-gregory-u-ca-gregory", "de-gregory", "de-u-ca-gregory", "de"], "de-gregory-u-ca-gregory": ["de-gregory-u-ca-gregory", "de-gregory", "de-u-ca-gregory", "de"],
"no-nyn": ["nn"], "no-nyn": ["nn"],
...@@ -33,10 +34,11 @@ var canonicalizedTags = { ...@@ -33,10 +34,11 @@ var canonicalizedTags = {
"x-foo": ["x-foo"] "x-foo": ["x-foo"]
}; };
Object.getOwnPropertyNames(canonicalizedTags).forEach(function (tag) { Object.keys(canonicalizedTags).forEach(function (tag) {
let locale = Intl.getCanonicalLocales(tag); let locale = Intl.getCanonicalLocales(tag);
if (!canonicalizedTags[tag].includes(locale[0])) { let expected = canonicalizedTags[tag];
$ERROR("For " + tag + " got " + locale + "; expected one of " + assert(
canonicalizedTags[tag].join(", ") + "."); expected.includes(locale[0]),
} `For ${tag} got ${locale}; expected one of ${expected.join(", ")}`,
);
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment