With the move to UTS 35 for language tag processing, the expected
canonicalisation results for "cel-gaulish" should now be consistent across
implementations.
The invalid 'numberingSystem' options test from RelativeTimeFormat covers a few
more cases, so let's reuse it for NumberFormat and DateTimeFormat.
While there, also add tests using non-ASCII inputs.
Fixes#2540
* Add test for different pattern based on calendar
* Add test for formatRangeToParts
* remove debug print
* fix typo
* fix typo
* address review feedback
* address review feedback
* change the map and use string template
* rewrite maps and use string template
* add tests for ListFormat
address https://github.com/tc39/test262/issues/2386
* add test for formatToParts(undefined)
* test GetIterator throw error
* test formatToParts while GetIterator throws error
* test formatToParts while step_iterator throw
* test format while iteratorStep throw
* fix object name
* test format while IteratorValue throws
* test formatToParts while iteratorValue throws
* test formatToParts while iteratorClose call return
* check format with iteratorClose calls return
The values defined by the referenced files are not used by these tests.
This makes their inclusion superfluous, which needlessly increases the
time to execute the tests and may confuse some readers.
* Rename "Object/proto-from-ctor.js" test
* Add missing "Symbol" features
* Add Intl.Collator test
* Add Intl.DateTimeFormat test
* Add Intl.NumberFormat test
* Add Intl.PluralRules test
* Unified Intl.NumberFormat: Test compact notation with various locales.
* Unified Intl.NumberFormat: Test compactDisplay constructor option.
* Unified Intl.NumberFormat: Test signDisplay constructor option.
* Unified Intl.NumberFormat: Test signDisplay with various locales.
* Unified Intl.NumberFormat: Test signDisplay with accounting currencySign in various locales.
* Unified Intl.NumberFormat: Test engineering and scientific notations in various locales.
* Unified Intl.NumberFormat: Test unit handling.
* Unified Intl.NumberFormat: Test notation constructor option.
* Unified Intl.NumberFormat: Test engineering and scientific notations with negative exponents.
* Unified Intl.NumberFormat: Test near-zero arguments with signDisplay.
* Unified Intl.NumberFormat: Test units.
* Unified Intl.NumberFormat: Test unit arguments.
* Unified Intl.NumberFormat: Add a generic test for unit arguments.
* Unified Intl.NumberFormat: Test the unitDisplay argument.
These two slipped through the cracks in #2097:
test/intl402/Intl/getCanonicalLocales/non-iana-canon.js
- Variant subtag canonicalisation is currrently not allowed.
test/intl402/Locale/getters.js
- Only the first "loc.caseFirst" test in this file was updated in #2097.
intl402/Intl/getCanonicalLocales/canonicalized-tags.js
- Sign languages are no longer canonicalised.
- Variant subtags are sorted alphabetically.
intl402/Intl/getCanonicalLocales/preferred-grandfathered.js
- Canonical form of "cel-gaulish" is "xtg-x-cel-gaulish".
intl402/Intl/getCanonicalLocales/preferred-variant.js
- Variant subtags are no longer canonicalised.
constructor-non-iana-canon.js
- Variant subtag canonicalisation is currently no longer present.
constructor-options-region-valid.js
- Digit region codes are now canonicalised.
constructor-tag.js
- Variant subtags are now sorted alphabetically.
likely-subtags-grandfathered.js
- "cmn" is now canonicalised to "zh".
This test started failing when updating to ICU 64, because ICU supports "zh"
and "zh-Hans-CN", but not explicitly also "zh-Hans", which is required for this
test to pass. The same kind of error is reproducible with ICU <64 when "Guru"
is added to the list of script codes in 'testIntl.js', because ICU supports
"pa-Guru-IN", but "pa-IN" isn't explicitly supported, too.
So, change this test to also check 'byFallback' to see if a locale is supported.
Drive-by change:
- Modernise the test to make it more readable how subtags are combined.
- Also add "419" to the list of region codes to cover the digit region syntax.
harness/testIntl.js
- Add now invalid tags to getInvalidLanguageTags, these tags were previously used in test files changed in this commit.
- Update isCanonicalizedStructurallyValidLanguageTag regular expressions.
test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
- Moved five now invalid tags to getInvalidLanguageTags function in testIntl.js
test/intl402/Intl/getCanonicalLocales/preferred-grandfathered.js
- All irregular grandfathered tags are invalid now
- Regular grandfathered with extlang subtags are now also invalid
- Regular grandfathered with variant-like subtags are still valid
test/intl402/Intl/getCanonicalLocales/weird-cases.js
- Revert changes from last commit
- "x-u-foo" is now invalid and was moved to getInvalidLanguageTags function
test/intl402/ListFormat/constructor/constructor/locales-valid.js
test/intl402/RelativeTimeFormat/constructor/constructor/locales-valid.js
test/intl402/Segmenter/constructor/constructor/locales-valid.js
- Irregular grandfathered and privateuse only are no longer valid language tags
test/intl402/language-tags-canonicalized.js
- Same changes as in test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
test/intl402/language-tags-invalid.js
- Invalid tags list in this file was a subset of getInvalidLanguageTags, so replaced with getInvalidLanguageTags to get more coverage
test/intl402/language-tags-valid.js
- Same changes as in test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
Main changes:
- "cmn" is now canonicalised to "zh"
- "und-x-" is prepended before grandfathered tags without modern replacements
- "und-" is prepended before privateuse-only language tags
The following lines expect each unit has property "-1" and "1"
```
const expected = unit in exceptions
? [exceptions[unit]["1"], exceptions[unit]["0"], exceptions[unit]["0"], exceptions[unit]["-1"]]
: [`in 1 ${unit}`, `in 0 ${unit}s`, `0 ${unit}s ago`, `1 ${unit} ago`];
```
Per https://tc39.github.io/ecma402/#sec-canonicalizelanguagetag
6.2.3 CanonicalizeLanguageTag ( locale )
The CanonicalizeLanguageTag abstract operation returns the canonical and case-regularized form of the locale argument (which must be a String value that is a structurally valid Unicode BCP 47 Locale Identifier as verified by the IsStructurallyValidLanguageTag abstract operation). A conforming implementation shall take the steps specified in the “BCP 47 Language Tag to Unicode BCP 47 Locale Identifier” algorithm, from Unicode Technical Standard #35 LDML § 3.3.1 BCP 47 Language Tag Conversion.
And
http://unicode.org/reports/tr35/#BCP_47_Language_Tag_Conversion
"
2. If the BCP 47 primary language subtag matches the type attribute of a languageAlias element in Supplemental Data, replace the language subtag with the replacement value.
If there are additional subtags in the replacement value, add them to the result, but only if there is no corresponding subtag already in the tag.
"
and
https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml
...
<languageAlias type="aar" replacement="aa" reason="overlong"/>
<!-- [Afar] -->
...
<languageAlias type="ces" replacement="cs" reason="overlong"/>
<!-- [Czech] -->
...
<languageAlias type="heb" replacement="he" reason="overlong"/>
<!-- [Hebrew] -->
Increase coverage for the Intl.DateTimeFormat constructor by adding a
test that confirms that ToObject(...) is appropriately called inside the
implementation.
* 'segmenter-v8' of git://github.com/Ms2ger/test262:
Intl.Segmenter: Submit batch of V8 tests for the iterators.
# Conflicts:
# implementation-contributed/v8/intl/segmenter/segment-iterator-ownPropertyDescriptor.js