Skip to content
Snippets Groups Projects
Commit 9345023d authored by Frank Yung-Fong Tang's avatar Frank Yung-Fong Tang Committed by Leo Balter
Browse files

move more cases from valid to invalid (#2047)

This is based on UTS35 in the new spec.
parent 9495886d
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,9 @@ info: | ...@@ -15,6 +15,9 @@ info: |
ApplyOptionsToTag( tag, options ) ApplyOptionsToTag( tag, options )
... ...
2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception. 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
3. Let language be ? GetOption(options, "language", "string", undefined, undefined).
4. If language is not undefined, then
a. If language does not match the unicode_language_subtag production, throw a RangeError exception.
IsStructurallyValidLanguageTag ( locale ) IsStructurallyValidLanguageTag ( locale )
...@@ -28,9 +31,6 @@ features: [Intl.Locale] ...@@ -28,9 +31,6 @@ features: [Intl.Locale]
---*/ ---*/
const validLanguageOptions = [ const validLanguageOptions = [
[null, 'null'],
['zh-cmn', 'cmn'],
['ZH-CMN', 'cmn'],
[{ toString() { return 'de' } }, 'de'], [{ toString() { return 'de' } }, 'de'],
]; ];
for (const [language, expected] of validLanguageOptions) { for (const [language, expected] of validLanguageOptions) {
...@@ -54,6 +54,9 @@ for (const [language, expected] of validLanguageOptions) { ...@@ -54,6 +54,9 @@ for (const [language, expected] of validLanguageOptions) {
} }
const invalidLanguageOptions = [ const invalidLanguageOptions = [
null,
'zh-cmn',
'ZH-CMN',
'abcd', 'abcd',
]; ];
for (const language of invalidLanguageOptions) { for (const language of invalidLanguageOptions) {
......
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