diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js')
-rw-r--r-- | js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js b/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js new file mode 100644 index 0000000000..20c37c7981 --- /dev/null +++ b/js/src/tests/test262/intl402/Locale/constructor-unicode-ext-valid.js @@ -0,0 +1,40 @@ +// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.locale +description: > + Verifies canonicalization of specific tags. +info: | + ApplyOptionsToTag( tag, options ) + 10. Return CanonicalizeLanguageTag(tag). +features: [Intl.Locale] +---*/ + +const validLanguageTags = { + // Duplicate keywords are removed. + "da-u-ca-gregory-ca-buddhist": "da-u-ca-gregory", + + // Keywords currently used in Intl specs are reordered in US-ASCII order. + "zh-u-nu-hans-ca-chinese": "zh-u-ca-chinese-nu-hans", + "zh-u-ca-chinese-nu-hans": "zh-u-ca-chinese-nu-hans", + + // Even keywords currently not used in Intl specs are reordered in US-ASCII order. + "de-u-cu-eur-nu-latn": "de-u-cu-eur-nu-latn", + "de-u-nu-latn-cu-eur": "de-u-cu-eur-nu-latn", + + // Attributes in Unicode extensions are reordered in US-ASCII order. + "pt-u-attr-ca-gregory": "pt-u-attr-ca-gregory", + "pt-u-attr1-attr2-ca-gregory": "pt-u-attr1-attr2-ca-gregory", + "pt-u-attr2-attr1-ca-gregory": "pt-u-attr1-attr2-ca-gregory", +}; + +for (const [langtag, canonical] of Object.entries(validLanguageTags)) { + assert.sameValue( + new Intl.Locale(langtag).toString(), + canonical, + `new Intl.Locale("${langtag}").toString() returns "${canonical}"` + ); +} + +reportCompare(0, 0); |