mirror of https://github.com/tc39/test262.git
Remove test of extlang and 4 letter language (#2030)
This is due to the fact we now only accept Unicode Locale Identifier in UTS 35.
This commit is contained in:
parent
9fccd9852e
commit
00d280d231
|
@ -13,10 +13,17 @@ info: |
|
|||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
|
||||
2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
|
||||
...
|
||||
9. If tag matches neither the privateuse nor the grandfathered production, then
|
||||
b. If language is not undefined, then
|
||||
i. Set tag to tag with the substring corresponding to the language production replaced by the string language.
|
||||
|
||||
IsStructurallyValidLanguageTag ( locale )
|
||||
|
||||
The IsStructurallyValidLanguageTag abstract operation verifies that the
|
||||
locale argument (which must be a String value)
|
||||
|
||||
represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
|
||||
Unicode Technical Standard 35 section 3.2, or successor,
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
@ -33,8 +40,4 @@ assert.sameValue(
|
|||
`new Intl.Locale('en-US', {language: undefined}).toString() returns "en-US"`
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en-els', {language: undefined}).toString(),
|
||||
'en-els',
|
||||
`new Intl.Locale('en-els', {language: undefined}).toString() returns "en-els"`
|
||||
);
|
||||
assert.throws(RangeError, () => new Intl.Locale('en-els', {language: undefined}));
|
||||
|
|
|
@ -14,9 +14,15 @@ info: |
|
|||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
9. If tag matches neither the privateuse nor the grandfathered production, then
|
||||
b. If language is not undefined, then
|
||||
i. Set tag to tag with the substring corresponding to the language production replaced by the string language.
|
||||
2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
|
||||
|
||||
IsStructurallyValidLanguageTag ( locale )
|
||||
|
||||
The IsStructurallyValidLanguageTag abstract operation verifies that the
|
||||
locale argument (which must be a String value)
|
||||
|
||||
represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
|
||||
Unicode Technical Standard 35 section 3.2, or successor,
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
@ -25,7 +31,6 @@ const validLanguageOptions = [
|
|||
[null, 'null'],
|
||||
['zh-cmn', 'cmn'],
|
||||
['ZH-CMN', 'cmn'],
|
||||
['abcd', 'abcd'],
|
||||
[{ toString() { return 'de' } }, 'de'],
|
||||
];
|
||||
for (const [language, expected] of validLanguageOptions) {
|
||||
|
@ -44,10 +49,15 @@ for (const [language, expected] of validLanguageOptions) {
|
|||
`new Intl.Locale('en-US', {language: "${language}"}).toString() returns "${expect}"`
|
||||
);
|
||||
|
||||
expect = expected || 'en-els';
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en-els', {language}).toString(),
|
||||
expect,
|
||||
`new Intl.Locale('en-els', {language: "${language}"}).toString() returns "${expect}"`
|
||||
);
|
||||
assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
|
||||
|
||||
}
|
||||
|
||||
const invalidLanguageOptions = [
|
||||
'abcd',
|
||||
];
|
||||
for (const language of invalidLanguageOptions) {
|
||||
assert.throws(RangeError, () => new Intl.Locale('en', {language}));
|
||||
assert.throws(RangeError, () => new Intl.Locale('en-US', {language}));
|
||||
assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue