Commit Graph

3 Commits

Author SHA1 Message Date
Frank Yung-Fong Tang 9997a26c7d
Fix tests on {localeMatcher: "lookup"} (#3008)
* Fix test for only {localeMatcher: "lookup"}

The expectation that "sr-Thai-RS" would be returned is only true with the 
9.2.2 BestAvailableLocale ( availableLocales, locale )
https://tc39.es/ecma402/#sec-bestavailablelocale
algorithm used by 9.2.3 LookupMatcher ( availableLocales, requestedLocales )
https://tc39.es/ecma402/#sec-lookupmatcher

The default for localeMatcher is "best fit" but not "lookup" for all Intl objects.

And for 9.2.4 BestFitMatcher ( availableLocales, requestedLocales )
https://tc39.es/ecma402/#sec-bestfitmatcher
It may not match "sr-Thai-RS" for "sr"  and return ["de", "zh-CN"] instead. Therefore, we need to change this test to only test on {localeMatcher: "lookup"}

* Add option to getLocaleSupportInfo

Needed to test different localeMatcher

* only test for "lookup" localeMatcher

* Get the info based on the localeMatcher

* pass in localeMatcher to getLocaleSupportInfo
2021-06-24 13:37:33 -04:00
André Bargull 1edeb484b8 Include locales supported through fallback when testing fallbacks
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.
2019-07-22 02:12:05 -07:00
André Bargull a380c6b000 Use more descriptive names for Intl test files 2017-12-21 16:46:56 -05:00