mirror of https://github.com/tc39/test262.git
Change expectation for x- private lang tag (#2046)
This commit is contained in:
parent
6da911b9f2
commit
9495886d18
|
@ -7,7 +7,9 @@ description: >
|
|||
Verifies canonicalization of specific tags.
|
||||
info: |
|
||||
ApplyOptionsToTag( tag, options )
|
||||
10. Return CanonicalizeLanguageTag(tag).
|
||||
2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
|
||||
...
|
||||
13. Return CanonicalizeLanguageTag(tag).
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
|
@ -16,17 +18,13 @@ const validLanguageTags = {
|
|||
"en-gb": "en-GB",
|
||||
"IT-LATN-iT": "it-Latn-IT",
|
||||
"th-th-u-nu-thai": "th-TH-u-nu-thai",
|
||||
"X-u-foo": "x-u-foo",
|
||||
"en-x-u-foo": "en-x-u-foo",
|
||||
"en-a-bar-x-u-foo": "en-a-bar-x-u-foo",
|
||||
"en-x-u-foo-a-bar": "en-x-u-foo-a-bar",
|
||||
"en-u-baz-a-bar-x-u-foo": "en-a-bar-u-baz-x-u-foo",
|
||||
"Flob": "flob",
|
||||
"ZORK": "zork",
|
||||
"Blah-latn": "blah-Latn",
|
||||
"QuuX-latn-us": "quux-Latn-US",
|
||||
"SPAM-gb-x-Sausages-BACON-eggs": "spam-GB-x-sausages-bacon-eggs",
|
||||
"DE-1996": "de-1996",
|
||||
"DE-1996": "de-1996", // unicode_language_subtag sep unicode_variant_subtag
|
||||
|
||||
// unicode_language_subtag (sep unicode_variant_subtag)*
|
||||
"sl-ROZAJ-BISKE-1994": "sl-rozaj-biske-1994",
|
||||
"zh-latn-pinyin-pinyin2": "zh-Latn-pinyin-pinyin2",
|
||||
};
|
||||
|
@ -43,3 +41,17 @@ for (const [langtag, canonical] of Object.entries(validLanguageTags)) {
|
|||
`new Intl.Locale("${langtag}").toString() returns "${canonical}"`
|
||||
);
|
||||
}
|
||||
|
||||
// unicode_language_subtag = alpha{2,3} | alpha{5,8};
|
||||
const invalidLanguageTags = {
|
||||
"X-u-foo",
|
||||
"Flob",
|
||||
"ZORK",
|
||||
"Blah-latn",
|
||||
"QuuX-latn-us",
|
||||
"SPAM-gb-x-Sausages-BACON-eggs",
|
||||
};
|
||||
|
||||
for (const langtag of Object.entries(invalidLanguageTags)) {
|
||||
assert.throws(RangeError, () => new Intl.Locale(langtag));
|
||||
}
|
||||
|
|
|
@ -8,39 +8,17 @@ description: >
|
|||
info: |
|
||||
ApplyOptionsToTag( tag, options )
|
||||
|
||||
|
||||
...
|
||||
9. If tag matches neither the privateuse nor the grandfathered production, then
|
||||
...
|
||||
|
||||
ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
|
||||
|
||||
...
|
||||
2. If tag matches the privateuse or the grandfathered production, then
|
||||
a. Let result be a new Record.
|
||||
b. Repeat for each element key of relevantExtensionKeys in List order,
|
||||
i. Set result.[[<key>]] to undefined.
|
||||
c. Set result.[[locale]] to tag.
|
||||
d. Return result.
|
||||
...
|
||||
7. Repeat for each element key of relevantExtensionKeys in List order,
|
||||
e. Let optionsValue be options.[[<key>]].
|
||||
f. If optionsValue is not undefined, then
|
||||
ii. Let value be optionsValue.
|
||||
iv. Else,
|
||||
1. Append the Record{[[Key]]: key, [[Value]]: value} to keywords.
|
||||
...
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const loc = new Intl.Locale("x-default", {
|
||||
assert.throws(RangeError, () => new Intl.Locale("x-default", {
|
||||
language: "fr",
|
||||
script: "Cyrl",
|
||||
region: "DE",
|
||||
numberingSystem: "latn",
|
||||
});
|
||||
assert.sameValue(loc.toString(), "fr-Cyrl-DE-u-nu-latn");
|
||||
assert.sameValue(loc.language, "fr");
|
||||
assert.sameValue(loc.script, "Cyrl");
|
||||
assert.sameValue(loc.region, "DE");
|
||||
assert.sameValue(loc.numberingSystem, "latn");
|
||||
}));
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// 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 getters with privateuse tags.
|
||||
info: |
|
||||
get Intl.Locale.prototype.baseName
|
||||
4. If locale does not match the langtag production, return locale.
|
||||
|
||||
get Intl.Locale.prototype.language
|
||||
4. If locale matches the privateuse or the grandfathered production, return locale.
|
||||
|
||||
get Intl.Locale.prototype.script
|
||||
4. If locale matches the privateuse or the grandfathered production, return undefined.
|
||||
|
||||
get Intl.Locale.prototype.region
|
||||
4. If locale matches the privateuse or the grandfathered production, return undefined.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
// Privateuse only language tag.
|
||||
var loc = new Intl.Locale("x-private");
|
||||
assert.sameValue(loc.baseName, "x-private");
|
||||
assert.sameValue(loc.language, "x-private");
|
||||
assert.sameValue(loc.script, undefined);
|
||||
assert.sameValue(loc.region, undefined);
|
|
@ -37,9 +37,6 @@ const testDataMaximal = {
|
|||
"und-419": "es-Latn-419",
|
||||
"und-150": "ru-Cyrl-RU",
|
||||
"und-AT": "de-Latn-AT",
|
||||
|
||||
// privateuse only.
|
||||
"x-private": "x-private",
|
||||
};
|
||||
|
||||
const testDataMinimal = {
|
||||
|
@ -65,9 +62,6 @@ const testDataMinimal = {
|
|||
"es-Latn-419": "es-419",
|
||||
"ru-Cyrl-RU": "ru",
|
||||
"de-Latn-AT": "de-AT",
|
||||
|
||||
// privateuse only.
|
||||
"x-private": "x-private",
|
||||
};
|
||||
|
||||
// Add variants, extensions, and privateuse subtags and ensure they don't
|
||||
|
@ -105,3 +99,8 @@ for (const [tag, minimal] of Object.entries(testDataMinimal)) {
|
|||
`"${input}".minimize() should be "${output}"`);
|
||||
}
|
||||
}
|
||||
|
||||
// privateuse only.
|
||||
// "x" in "x-private" does not match unicode_language_subtag
|
||||
// unicode_language_subtag = alpha{2,3} | alpha{5,8};
|
||||
assert.throws(RangeError, () => new Intl.Locale("x-private"));
|
||||
|
|
Loading…
Reference in New Issue