tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

localeMatcherTest.txt (48963B)


      1 # © 2017 and later: Unicode, Inc. and others.
      2 # License & terms of use: http://www.unicode.org/copyright.html
      3 #
      4 # Data-driven test for the language/locale matcher.
      5 # Format:
      6 #
      7 # Everything after "#" is a comment.
      8 # ** test: This line starts a group of test cases.
      9 #
     10 # Lines starting with an '@' sign provide matcher parameters.
     11 # @supported=<comma-separated supported languages>
     12 # @default=<default language>  # no value = no explicit default
     13 # @favor=[normal|script]  # no value = no explicit setting
     14 # @threshold=<number 0..100>  # no value = no explicit setting
     15 #
     16 # A line with ">>" is a getBestMatch() test case:
     17 # <comma-separated desired languages> >> match | desired | combined
     18 # - match is the expected best supported language
     19 # - desired is the expected best desired language
     20 # - combined is the expected result of combine(match, desired)
     21 # An expected language can be "null" to check for the matcher returning null.
     22 # An empty or omitted value is not tested. (Omitted = not even the '|' separator.)
     23 #
     24 # ** test: A new test group resets all matcher parameters.
     25 
     26 ## X
     27 
     28 ** test: testParentLocales
     29 
     30 # es-419, es-AR, and es-MX are in a cluster; es is in a different one
     31 
     32 @supported=es-419, es-ES
     33 es-AR >> es-419
     34 @supported=es-ES, es-419
     35 es-AR >> es-419
     36 
     37 @supported=es-419, es
     38 es-AR >> es-419
     39 @supported=es, es-419
     40 es-AR >> es-419
     41 
     42 @supported=es-MX, es
     43 es-AR >> es-MX
     44 @supported=es, es-MX
     45 es-AR >> es-MX
     46 
     47 # en-GB, en-AU, and en-NZ are in a cluster; en in a different one
     48 
     49 @supported=en-GB, en-US
     50 en-AU >> en-GB
     51 @supported=en-US, en-GB
     52 en-AU >> en-GB
     53 
     54 @supported=en-GB, en
     55 en-AU >> en-GB
     56 @supported=en, en-GB
     57 en-AU >> en-GB
     58 
     59 @supported=en-NZ, en-US
     60 en-AU >> en-NZ
     61 @supported=en-US, en-NZ
     62 en-AU >> en-NZ
     63 
     64 @supported=en-NZ, en
     65 en-AU >> en-NZ
     66 @supported=en, en-NZ
     67 en-AU >> en-NZ
     68 
     69 # pt-AU and pt-PT in one cluster; pt-BR in another
     70 
     71 @supported=pt-PT, pt-BR
     72 pt-AO >> pt-PT
     73 @supported=pt-BR, pt-PT
     74 pt-AO >> pt-PT
     75 
     76 @supported=pt-PT, pt
     77 pt-AO >> pt-PT
     78 @supported=pt, pt-PT
     79 pt-AO >> pt-PT
     80 
     81 @supported=zh-MO, zh-TW
     82 zh-HK >> zh-MO
     83 @supported=zh-TW, zh-MO
     84 zh-HK >> zh-MO
     85 
     86 @supported=zh-MO, zh-CN
     87 zh-HK >> zh-MO
     88 @supported=zh-CN, zh-MO
     89 zh-HK >> zh-MO
     90 
     91 @supported=zh-MO, zh
     92 zh-HK >> zh-MO
     93 @supported=zh, zh-MO
     94 zh-HK >> zh-MO
     95 
     96 @favor=script
     97 @supported=es-419, es-ES
     98 es-AR >> es-419
     99 @supported=es-ES, es-419
    100 es-AR >> es-419
    101 @supported=es-419, es
    102 es-AR >> es-419
    103 @supported=es, es-419
    104 es-AR >> es-419
    105 @supported=es-MX, es
    106 es-AR >> es-MX
    107 @supported=es, es-MX
    108 es-AR >> es-MX
    109 @supported=en-GB, en-US
    110 en-AU >> en-GB
    111 @supported=en-US, en-GB
    112 en-AU >> en-GB
    113 @supported=en-GB, en
    114 en-AU >> en-GB
    115 @supported=en, en-GB
    116 en-AU >> en-GB
    117 @supported=en-NZ, en-US
    118 en-AU >> en-NZ
    119 @supported=en-US, en-NZ
    120 en-AU >> en-NZ
    121 @supported=en-NZ, en
    122 en-AU >> en-NZ
    123 @supported=en, en-NZ
    124 en-AU >> en-NZ
    125 @supported=pt-PT, pt-BR
    126 pt-AO >> pt-PT
    127 @supported=pt-BR, pt-PT
    128 pt-AO >> pt-PT
    129 @supported=pt-PT, pt
    130 pt-AO >> pt-PT
    131 @supported=pt, pt-PT
    132 pt-AO >> pt-PT
    133 @supported=zh-MO, zh-TW
    134 zh-HK >> zh-MO
    135 @supported=zh-TW, zh-MO
    136 zh-HK >> zh-MO
    137 @supported=zh-MO, zh-CN
    138 zh-HK >> zh-MO
    139 @supported=zh-CN, zh-MO
    140 zh-HK >> zh-MO
    141 @supported=zh-MO, zh
    142 zh-HK >> zh-MO
    143 @supported=zh, zh-MO
    144 zh-HK >> zh-MO
    145 
    146 ** test: testChinese
    147 
    148 @supported=zh-CN, zh-TW, iw
    149 zh-Hant-TW >> zh-TW
    150 zh-Hant >> zh-TW
    151 zh-TW >> zh-TW
    152 zh-Hans-CN >> zh-CN
    153 zh-CN >> zh-CN
    154 zh >> zh-CN
    155 
    156 @favor=script
    157 zh-Hant-TW >> zh-TW
    158 zh-Hant >> zh-TW
    159 zh-TW >> zh-TW
    160 zh-Hans-CN >> zh-CN
    161 zh-CN >> zh-CN
    162 zh >> zh-CN
    163 
    164 ** test: testenGB
    165 
    166 @supported=fr, en, en-GB, es-419, es-MX, es
    167 en-NZ >> en-GB
    168 es-ES >> es
    169 es-AR >> es-419
    170 es-MX >> es-MX
    171 
    172 @favor=script
    173 en-NZ >> en-GB
    174 es-ES >> es
    175 es-AR >> es-419
    176 es-MX >> es-MX
    177 
    178 ** test: testFallbacks
    179 
    180 @supported=91, en, hi
    181 sa >> hi
    182 
    183 @favor=script
    184 sa >> hi
    185 
    186 ** test: testBasics
    187 
    188 @supported=fr, en-GB, en
    189 en-GB >> en-GB
    190 en >> en
    191 fr >> fr
    192 ja >> fr # return first if no match
    193 
    194 @favor=script
    195 en-GB >> en-GB
    196 en >> en
    197 fr >> fr
    198 ja >> fr
    199 
    200 ** test: testFallback
    201 
    202 # check that script fallbacks are handled right
    203 
    204 @supported=zh-CN, zh-TW, iw
    205 zh-Hant >> zh-TW
    206 zh >> zh-CN
    207 zh-Hans-CN >> zh-CN
    208 zh-Hant-HK >> zh-TW
    209 he-IT >> iw
    210 
    211 @favor=script
    212 zh-Hant >> zh-TW
    213 zh >> zh-CN
    214 zh-Hans-CN >> zh-CN
    215 zh-Hant-HK >> zh-TW
    216 he-IT >> iw
    217 
    218 ** test: testSpecials
    219 
    220 # check that nearby languages are handled
    221 
    222 @supported=en, fil, ro, nn
    223 tl >> fil
    224 mo >> ro
    225 nb >> nn
    226 
    227 # make sure default works
    228 
    229 ja >> en
    230 
    231 @favor=script
    232 tl >> fil
    233 mo >> ro
    234 nb >> nn
    235 ja >> en
    236 
    237 ** test: testRegionalSpecials
    238 
    239 # verify that en-AU is closer to en-GB than to en (which is en-US)
    240 
    241 @supported=en, en-GB, es, es-419
    242 es-MX >> es-419
    243 en-AU >> en-GB
    244 es-ES >> es
    245 
    246 @favor=script
    247 es-MX >> es-419
    248 en-AU >> en-GB
    249 es-ES >> es
    250 
    251 ** test: testHK
    252 
    253 # HK and MO are closer to each other for Hant than to TW
    254 
    255 @supported=zh, zh-TW, zh-MO
    256 zh-HK >> zh-MO
    257 @supported=zh, zh-TW, zh-HK
    258 zh-MO >> zh-HK
    259 
    260 @favor=script
    261 @supported=zh, zh-TW, zh-MO
    262 zh-HK >> zh-MO
    263 @supported=zh, zh-TW, zh-HK
    264 zh-MO >> zh-HK
    265 
    266 ** test: testMatch-matchOnMazimized
    267 
    268 @supported=zh, zh-Hant
    269 und-TW >> zh-Hant # und-TW should be closer to zh-Hant than to zh
    270 
    271 @supported=en-Hant-TW, und-TW
    272 zh-Hant >> und-TW # zh-Hant should be closer to und-TW than to en-Hant-TW
    273 zh >> en-Hant-TW # no match so get first
    274 
    275 @favor=script
    276 @supported=zh, zh-Hant
    277 und-TW >> zh-Hant
    278 @supported=en-Hant-TW, und-TW
    279 zh-Hant >> und-TW
    280 zh >> en-Hant-TW # no match so get first
    281 
    282 ** test: testMatchLegacyCode
    283 
    284 @supported=fr, i-klingon, en-Latn-US
    285 en-GB-oed >> en-Latn-US
    286 
    287 @favor=script
    288 en-GB-oed >> en-Latn-US
    289 
    290 ** test: testGetBestMatchForList-exactMatch
    291 @supported=fr, en-GB, ja, es-ES, es-MX
    292 ja, de >> ja
    293 
    294 @favor=script
    295 ja, de >> ja
    296 
    297 ** test: testGetBestMatchForList-simpleVariantMatch
    298 @supported=fr, en-GB, ja, es-ES, es-MX
    299 de, en-US >> en-GB # Intentionally avoiding a perfect-match or two candidates for variant matches.
    300 
    301 # Fallback.
    302 
    303 de, zh >> fr
    304 
    305 @favor=script
    306 de, en-US >> en-GB
    307 de, zh >> fr
    308 
    309 ** test: testGetBestMatchForList-matchOnMaximized
    310 # Check that if the preference is maximized already, it works as well.
    311 
    312 @supported=en, ja
    313 ja-Jpan-JP, en-AU >> ja # Match for ja-Jpan-JP (maximized already)
    314 
    315 # ja-JP matches ja on likely subtags, and it's listed first, thus it wins over the second preference en-GB.
    316 
    317 ja-JP, en-US >> ja # Match for ja-Jpan-JP (maximized already)
    318 
    319 # Check that if the preference is maximized already, it works as well.
    320 
    321 ja-Jpan-JP, en-US >> ja # Match for ja-Jpan-JP (maximized already)
    322 
    323 @favor=script
    324 ja-Jpan-JP, en-AU >> ja
    325 ja-JP, en-US >> ja
    326 ja-Jpan-JP, en-US >> ja
    327 
    328 ** test: testGetBestMatchForList-noMatchOnMaximized
    329 # Regression test for http://b/5714572 .
    330 # de maximizes to de-DE. Pick the exact match for the secondary language instead.
    331 @supported=en, de, fr, ja
    332 de-CH, fr >> de
    333 
    334 @favor=script
    335 de-CH, fr >> de
    336 
    337 ** test: testBestMatchForTraditionalChinese
    338 
    339 # Scenario: An application that only supports Simplified Chinese (and some other languages),
    340 # but does not support Traditional Chinese. zh-Hans-CN could be replaced with zh-CN, zh, or
    341 # zh-Hans, it wouldn't make much of a difference.
    342 
    343 # The script distance (simplified vs. traditional Han) is considered small enough
    344 # to be an acceptable match. The regional difference is considered almost insignificant.
    345 
    346 @supported=fr, zh-Hans-CN, en-US
    347 zh-TW >> fr # no match so get first
    348 zh-Hant >> fr # no match so get first
    349 
    350 # For geopolitical reasons, you might want to avoid a zh-Hant -> zh-Hans match.
    351 # In this case, if zh-TW, zh-HK or a tag starting with zh-Hant is requested, you can
    352 # change your call to getBestMatch to include a 2nd language preference.
    353 # "en" is a better match since its distance to "en-US" is closer than the distance
    354 # from "zh-TW" to "zh-CN" (script distance).
    355 
    356 zh-TW, en >> en-US
    357 zh-Hant-CN, en >> en-US
    358 zh-Hans, en >> zh-Hans-CN
    359 
    360 @favor=script
    361 zh-TW >> fr # no match so get first
    362 zh-Hant >> fr # no match so get first
    363 zh-TW, en >> en-US
    364 zh-Hant-CN, en >> en-US
    365 zh-Hans, en >> zh-Hans-CN
    366 
    367 ** test: testUndefined
    368 # When the undefined language doesn't match anything in the list,
    369 # getBestMatch returns the default, as usual.
    370 
    371 @supported=it, fr
    372 und >> it
    373 
    374 # When it *does* occur in the list, bestMatch returns it, as expected.
    375 @supported=it, und
    376 und >> und
    377 
    378 # The unusual part: max("und") = "en-Latn-US", and since matching is based on maximized
    379 # tags, the undefined language would normally match English. But that would produce the
    380 # counterintuitive results that getBestMatch("und", XLocaleMatcher("it,en")) would be "en", and
    381 # getBestMatch("en", XLocaleMatcher("it,und")) would be "und".
    382 
    383 # To avoid that, we change the matcher's definitions of max
    384 # so that max("und")="und". That produces the following, more desirable
    385 # results:
    386 
    387 @supported=it, en
    388 und >> it
    389 @supported=it, und
    390 en >> it
    391 
    392 @favor=script
    393 @supported=it, fr
    394 und >> it
    395 @supported=it, und
    396 und >> und
    397 @supported=it, en
    398 und >> it
    399 @supported=it, und
    400 en >> it
    401 
    402 ** test: testGetBestMatch-regionDistance
    403 
    404 @supported=es-AR, es
    405 es-MX >> es-AR
    406 @supported=fr, en, en-GB
    407 en-CA >> en
    408 @supported=de-AT, de-DE, de-CH
    409 de >> de-DE
    410 
    411 @favor=script
    412 @supported=es-AR, es
    413 es-MX >> es-AR
    414 @supported=fr, en, en-GB
    415 en-CA >> en
    416 @supported=de-AT, de-DE, de-CH
    417 de >> de-DE
    418 
    419 ** test: testAsymmetry
    420 
    421 @supported=mul, nl
    422 af >> mul # af => mul
    423 @supported=mul, af
    424 nl >> mul # but nl !=> af
    425 
    426 @favor=script
    427 @supported=mul, nl
    428 af >> mul
    429 @supported=mul, af
    430 nl >> mul
    431 
    432 ** test: testGetBestMatchForList-matchOnMaximized2
    433 
    434 # ja-JP matches ja on likely subtags, and it's listed first, thus it wins over the second preference en-GB.
    435 
    436 @supported=fr, en-GB, ja, es-ES, es-MX
    437 ja-JP, en-GB >> ja # Match for ja-JP, with likely region subtag
    438 
    439 # Check that if the preference is maximized already, it works as well.
    440 
    441 ja-Jpan-JP, en-GB >> ja # Match for ja-Jpan-JP (maximized already)
    442 
    443 @favor=script
    444 ja-JP, en-GB >> ja
    445 ja-Jpan-JP, en-GB >> ja
    446 
    447 ** test: testGetBestMatchForList-closeEnoughMatchOnMaximized
    448 
    449 @supported=en-GB, en, de, fr, ja
    450 de-CH, fr >> de
    451 en-US, ar, nl, de, ja >> en
    452 
    453 @favor=script
    454 de-CH, fr >> de
    455 en-US, ar, nl, de, ja >> en
    456 
    457 ** test: testGetBestMatchForPortuguese
    458 
    459 # pt might be supported and not pt-PT
    460 
    461 # European user who prefers Spanish over Brazilian Portuguese as a fallback.
    462 
    463 @supported=pt-PT, pt-BR, es, es-419
    464 pt-PT, es, pt >> pt-PT
    465 @supported=pt-PT, pt, es, es-419
    466 pt-PT, es, pt >> pt-PT # pt implicit
    467 
    468 # Brazilian user who prefers South American Spanish over European Portuguese as a fallback.
    469 # The asymmetry between this case and above is because it's "pt-PT" that's missing between the
    470 # matchers as "pt-BR" is a much more common language.
    471 
    472 @supported=pt-PT, pt-BR, es, es-419
    473 pt, es-419, pt-PT >> pt-BR
    474 pt-PT, es, pt >> pt-PT
    475 @supported=pt-PT, pt, es, es-419
    476 pt-PT, es, pt >> pt-PT
    477 pt, es-419, pt-PT >> pt
    478 
    479 @supported=pt-BR, es, es-419
    480 pt, es-419, pt-PT >> pt-BR
    481 
    482 # Code that adds the user's country can get "pt-US" for a user's language.
    483 # That should fall back to "pt-BR".
    484 
    485 @supported=pt-PT, pt-BR, es, es-419
    486 pt-US, pt-PT >> pt-BR
    487 @supported=pt-PT, pt, es, es-419
    488 pt-US, pt-PT, pt >> pt # pt-BR implicit
    489 
    490 @favor=script
    491 @supported=pt-PT, pt-BR, es, es-419
    492 pt-PT, es, pt >> pt-PT
    493 @supported=pt-PT, pt, es, es-419
    494 pt-PT, es, pt >> pt-PT
    495 
    496 @supported=pt-PT, pt-BR, es, es-419
    497 pt, es-419, pt-PT >> pt-BR
    498 pt-PT, es, pt >> pt-PT
    499 @supported=pt-PT, pt, es, es-419
    500 pt-PT, es, pt >> pt-PT
    501 pt, es-419, pt-PT >> pt
    502 
    503 @supported=pt-BR, es, es-419
    504 pt, es-419, pt-PT >> pt-BR
    505 
    506 @supported=pt-PT, pt-BR, es, es-419
    507 pt-US, pt-PT >> pt-BR
    508 @supported=pt-PT, pt, es, es-419
    509 pt-US, pt-PT, pt >> pt
    510 
    511 ** test: testVariantWithScriptMatch 1 and 2
    512 
    513 @supported=fr, en, sv
    514 en-GB >> en
    515 @supported=en, sv
    516 en-GB, sv >> en
    517 
    518 @favor=script
    519 @supported=fr, en, sv
    520 en-GB >> en
    521 @supported=en, sv
    522 en-GB, sv >> en
    523 
    524 ** test: testLongLists
    525 
    526 @supported=en, sv
    527 sv >> sv
    528 
    529 @supported=af, am, ar, az, be, bg, bn, bs, ca, cs, cy, da, de, el, en, en-GB, es, es-419, et, eu, fa, fi, fil, fr, ga, gl, gu, hi, hr, hu, hy, id, is, it, iw, ja, ka, kk, km, kn, ko, ky, lo, lt, lv, mk, ml, mn, mr, ms, my, ne, nl, no, pa, pl, pt, pt-PT, ro, ru, si, sk, sl, sq, sr, sr-Latn, sv, sw, ta, te, th, tr, uk, ur, uz, vi, zh-CN, zh-TW, zu
    530 sv >> sv
    531 
    532 @supported=af, af-NA, af-ZA, agq, agq-CM, ak, ak-GH, am, am-ET, ar, ar-001, ar-AE, ar-BH, ar-DJ, ar-DZ, ar-EG, ar-EH, ar-ER, ar-IL, ar-IQ, ar-JO, ar-KM, ar-KW, ar-LB, ar-LY, ar-MA, ar-MR, ar-OM, ar-PS, ar-QA, ar-SA, ar-SD, ar-SO, ar-SS, ar-SY, ar-TD, ar-TN, ar-YE, as, as-IN, asa, asa-TZ, ast, ast-ES, az, az-Cyrl, az-Cyrl-AZ, az-Latn, az-Latn-AZ, bas, bas-CM, be, be-BY, bem, bem-ZM, bez, bez-TZ, bg, bg-BG, bm, bm-ML, bn, bn-BD, bn-IN, bo, bo-CN, bo-IN, br, br-FR, brx, brx-IN, bs, bs-Cyrl, bs-Cyrl-BA, bs-Latn, bs-Latn-BA, ca, ca-AD, ca-ES, ca-ES-VALENCIA, ca-FR, ca-IT, ce, ce-RU, cgg, cgg-UG, chr, chr-US, ckb, ckb-IQ, ckb-IR, cs, cs-CZ, cu, cu-RU, cy, cy-GB, da, da-DK, da-GL, dav, dav-KE, de, de-AT, de-BE, de-CH, de-DE, de-LI, de-LU, dje, dje-NE, dsb, dsb-DE, dua, dua-CM, dyo, dyo-SN, dz, dz-BT, ebu, ebu-KE, ee, ee-GH, ee-TG, el, el-CY, el-GR, en, en-001, en-150, en-AG, en-AI, en-AS, en-AT, en-AU, en-BB, en-BE, en-BI, en-BM, en-BS, en-BW, en-BZ, en-CA, en-CC, en-CH, en-CK, en-CM, en-CX, en-CY, en-DE, en-DG, en-DK, en-DM, en-ER, en-FI, en-FJ, en-FK, en-FM, en-GB, en-GD, en-GG, en-GH, en-GI, en-GM, en-GU, en-GY, en-HK, en-IE, en-IL, en-IM, en-IN, en-IO, en-JE, en-JM, en-KE, en-KI, en-KN, en-KY, en-LC, en-LR, en-LS, en-MG, en-MH, en-MO, en-MP, en-MS, en-MT, en-MU, en-MW, en-MY, en-NA, en-NF, en-NG, en-NL, en-NR, en-NU, en-NZ, en-PG, en-PH, en-PK, en-PN, en-PR, en-PW, en-RW, en-SB, en-SC, en-SD, en-SE, en-SG, en-SH, en-SI, en-SL, en-SS, en-SX, en-SZ, en-TC, en-TK, en-TO, en-TT, en-TV, en-TZ, en-UG, en-UM, en-US, en-US-POSIX, en-VC, en-VG, en-VI, en-VU, en-WS, en-ZA, en-ZM, en-ZW, eo, eo-001, es, es-419, es-AR, es-BO, es-CL, es-CO, es-CR, es-CU, es-DO, es-EA, es-EC, es-ES, es-GQ, es-GT, es-HN, es-IC, es-MX, es-NI, es-PA, es-PE, es-PH, es-PR, es-PY, es-SV, es-US, es-UY, es-VE, et, et-EE, eu, eu-ES, ewo, ewo-CM, fa, fa-AF, fa-IR, ff, ff-CM, ff-GN, ff-MR, ff-SN, fi, fi-FI, fil, fil-PH, fo, fo-DK, fo-FO, fr, fr-BE, fr-BF, fr-BI, fr-BJ, fr-BL, fr-CA, fr-CD, fr-CF, fr-CG, fr-CH, fr-CI, fr-CM, fr-DJ, fr-DZ, fr-FR, fr-GA, fr-GF, fr-GN, fr-GP, fr-GQ, fr-HT, fr-KM, fr-LU, fr-MA, fr-MC, fr-MF, fr-MG, fr-ML, fr-MQ, fr-MR, fr-MU, fr-NC, fr-NE, fr-PF, fr-PM, fr-RE, fr-RW, fr-SC, fr-SN, fr-SY, fr-TD, fr-TG, fr-TN, fr-VU, fr-WF, fr-YT, fur, fur-IT, fy, fy-NL, ga, ga-IE, gd, gd-GB, gl, gl-ES, gsw, gsw-CH, gsw-FR, gsw-LI, gu, gu-IN, guz, guz-KE, gv, gv-IM, ha, ha-GH, ha-NE, ha-NG, haw, haw-US, he, he-IL, hi, hi-IN, hr, hr-BA, hr-HR, hsb, hsb-DE, hu, hu-HU, hy, hy-AM, id, id-ID, ig, ig-NG, ii, ii-CN, is, is-IS, it, it-CH, it-IT, it-SM, ja, ja-JP, jgo, jgo-CM, jmc, jmc-TZ, ka, ka-GE, kab, kab-DZ, kam, kam-KE, kde, kde-TZ, kea, kea-CV, khq, khq-ML, ki, ki-KE, kk, kk-KZ, kkj, kkj-CM, kl, kl-GL, kln, kln-KE, km, km-KH, kn, kn-IN, ko, ko-KP, ko-KR, kok, kok-IN, ks, ks-IN, ksb, ksb-TZ, ksf, ksf-CM, ksh, ksh-DE, kw, kw-GB, ky, ky-KG, lag, lag-TZ, lb, lb-LU, lg, lg-UG, lkt, lkt-US, ln, ln-AO, ln-CD, ln-CF, ln-CG, lo, lo-LA, lrc, lrc-IQ, lrc-IR, lt, lt-LT, lu, lu-CD, luo, luo-KE, luy, luy-KE, lv, lv-LV, mas, mas-KE, mas-TZ, mer, mer-KE, mfe, mfe-MU, mg, mg-MG, mgh, mgh-MZ, mgo, mgo-CM, mk, mk-MK, ml, ml-IN, mn, mn-MN, mr, mr-IN, ms, ms-BN, ms-MY, ms-SG, mt, mt-MT, mua, mua-CM, my, my-MM, mzn, mzn-IR, naq, naq-NA, nb, nb-NO, nb-SJ, nd, nd-ZW, ne, ne-IN, ne-NP, nl, nl-AW, nl-BE, nl-BQ, nl-CW, nl-NL, nl-SR, nl-SX, nmg, nmg-CM, nn, nn-NO, nnh, nnh-CM, nus, nus-SS, nyn, nyn-UG, om, om-ET, om-KE, or, or-IN, os, os-GE, os-RU, pa, pa-Arab, pa-Arab-PK, pa-Guru, pa-Guru-IN, pl, pl-PL, prg, prg-001, ps, ps-AF, pt, pt-AO, pt-BR, pt-CV, pt-GW, pt-MO, pt-MZ, pt-PT, pt-ST, pt-TL, qu, qu-BO, qu-EC, qu-PE, rm, rm-CH, rn, rn-BI, ro, ro-MD, ro-RO, rof, rof-TZ, root, ru, ru-BY, ru-KG, ru-KZ, ru-MD, ru-RU, ru-UA, rw, rw-RW, rwk, rwk-TZ, sah, sah-RU, saq, saq-KE, sbp, sbp-TZ, se, se-FI, se-NO, se-SE, seh, seh-MZ, ses, ses-ML, sg, sg-CF, shi, shi-Latn, shi-Latn-MA, shi-Tfng, shi-Tfng-MA, si, si-LK, sk, sk-SK, sl, sl-SI, smn, smn-FI, sn, sn-ZW, so, so-DJ, so-ET, so-KE, so-SO, sq, sq-AL, sq-MK, sq-XK, sr, sr-Cyrl, sr-Cyrl-BA, sr-Cyrl-ME, sr-Cyrl-RS, sr-Cyrl-XK, sr-Latn, sr-Latn-BA, sr-Latn-ME, sr-Latn-RS, sr-Latn-XK, sv, sv-AX, sv-FI, sv-SE, sw, sw-CD, sw-KE, sw-TZ, sw-UG, ta, ta-IN, ta-LK, ta-MY, ta-SG, te, te-IN, teo, teo-KE, teo-UG, th, th-TH, ti, ti-ER, ti-ET, tk, tk-TM, to, to-TO, tr, tr-CY, tr-TR, twq, twq-NE, tzm, tzm-MA, ug, ug-CN, uk, uk-UA, ur, ur-IN, ur-PK, uz, uz-Arab, uz-Arab-AF, uz-Cyrl, uz-Cyrl-UZ, uz-Latn, uz-Latn-UZ, vai, vai-Latn, vai-Latn-LR, vai-Vaii, vai-Vaii-LR, vi, vi-VN, vo, vo-001, vun, vun-TZ, wae, wae-CH, xog, xog-UG, yav, yav-CM, yi, yi-001, yo, yo-BJ, yo-NG, zgh, zgh-MA, zh, zh-Hans, zh-Hans-CN, zh-Hans-HK, zh-Hans-MO, zh-Hans-SG, zh-Hant, zh-Hant-HK, zh-Hant-MO, zh-Hant-TW, zu, zu-ZA
    533 sv >> sv
    534 
    535 @favor=script
    536 @supported=en, sv
    537 sv >> sv
    538 
    539 @supported=af, am, ar, az, be, bg, bn, bs, ca, cs, cy, da, de, el, en, en-GB, es, es-419, et, eu, fa, fi, fil, fr, ga, gl, gu, hi, hr, hu, hy, id, is, it, iw, ja, ka, kk, km, kn, ko, ky, lo, lt, lv, mk, ml, mn, mr, ms, my, ne, nl, no, pa, pl, pt, pt-PT, ro, ru, si, sk, sl, sq, sr, sr-Latn, sv, sw, ta, te, th, tr, uk, ur, uz, vi, zh-CN, zh-TW, zu
    540 sv >> sv
    541 
    542 @supported=af, af-NA, af-ZA, agq, agq-CM, ak, ak-GH, am, am-ET, ar, ar-001, ar-AE, ar-BH, ar-DJ, ar-DZ, ar-EG, ar-EH, ar-ER, ar-IL, ar-IQ, ar-JO, ar-KM, ar-KW, ar-LB, ar-LY, ar-MA, ar-MR, ar-OM, ar-PS, ar-QA, ar-SA, ar-SD, ar-SO, ar-SS, ar-SY, ar-TD, ar-TN, ar-YE, as, as-IN, asa, asa-TZ, ast, ast-ES, az, az-Cyrl, az-Cyrl-AZ, az-Latn, az-Latn-AZ, bas, bas-CM, be, be-BY, bem, bem-ZM, bez, bez-TZ, bg, bg-BG, bm, bm-ML, bn, bn-BD, bn-IN, bo, bo-CN, bo-IN, br, br-FR, brx, brx-IN, bs, bs-Cyrl, bs-Cyrl-BA, bs-Latn, bs-Latn-BA, ca, ca-AD, ca-ES, ca-ES-VALENCIA, ca-FR, ca-IT, ce, ce-RU, cgg, cgg-UG, chr, chr-US, ckb, ckb-IQ, ckb-IR, cs, cs-CZ, cu, cu-RU, cy, cy-GB, da, da-DK, da-GL, dav, dav-KE, de, de-AT, de-BE, de-CH, de-DE, de-LI, de-LU, dje, dje-NE, dsb, dsb-DE, dua, dua-CM, dyo, dyo-SN, dz, dz-BT, ebu, ebu-KE, ee, ee-GH, ee-TG, el, el-CY, el-GR, en, en-001, en-150, en-AG, en-AI, en-AS, en-AT, en-AU, en-BB, en-BE, en-BI, en-BM, en-BS, en-BW, en-BZ, en-CA, en-CC, en-CH, en-CK, en-CM, en-CX, en-CY, en-DE, en-DG, en-DK, en-DM, en-ER, en-FI, en-FJ, en-FK, en-FM, en-GB, en-GD, en-GG, en-GH, en-GI, en-GM, en-GU, en-GY, en-HK, en-IE, en-IL, en-IM, en-IN, en-IO, en-JE, en-JM, en-KE, en-KI, en-KN, en-KY, en-LC, en-LR, en-LS, en-MG, en-MH, en-MO, en-MP, en-MS, en-MT, en-MU, en-MW, en-MY, en-NA, en-NF, en-NG, en-NL, en-NR, en-NU, en-NZ, en-PG, en-PH, en-PK, en-PN, en-PR, en-PW, en-RW, en-SB, en-SC, en-SD, en-SE, en-SG, en-SH, en-SI, en-SL, en-SS, en-SX, en-SZ, en-TC, en-TK, en-TO, en-TT, en-TV, en-TZ, en-UG, en-UM, en-US, en-US-POSIX, en-VC, en-VG, en-VI, en-VU, en-WS, en-ZA, en-ZM, en-ZW, eo, eo-001, es, es-419, es-AR, es-BO, es-CL, es-CO, es-CR, es-CU, es-DO, es-EA, es-EC, es-ES, es-GQ, es-GT, es-HN, es-IC, es-MX, es-NI, es-PA, es-PE, es-PH, es-PR, es-PY, es-SV, es-US, es-UY, es-VE, et, et-EE, eu, eu-ES, ewo, ewo-CM, fa, fa-AF, fa-IR, ff, ff-CM, ff-GN, ff-MR, ff-SN, fi, fi-FI, fil, fil-PH, fo, fo-DK, fo-FO, fr, fr-BE, fr-BF, fr-BI, fr-BJ, fr-BL, fr-CA, fr-CD, fr-CF, fr-CG, fr-CH, fr-CI, fr-CM, fr-DJ, fr-DZ, fr-FR, fr-GA, fr-GF, fr-GN, fr-GP, fr-GQ, fr-HT, fr-KM, fr-LU, fr-MA, fr-MC, fr-MF, fr-MG, fr-ML, fr-MQ, fr-MR, fr-MU, fr-NC, fr-NE, fr-PF, fr-PM, fr-RE, fr-RW, fr-SC, fr-SN, fr-SY, fr-TD, fr-TG, fr-TN, fr-VU, fr-WF, fr-YT, fur, fur-IT, fy, fy-NL, ga, ga-IE, gd, gd-GB, gl, gl-ES, gsw, gsw-CH, gsw-FR, gsw-LI, gu, gu-IN, guz, guz-KE, gv, gv-IM, ha, ha-GH, ha-NE, ha-NG, haw, haw-US, he, he-IL, hi, hi-IN, hr, hr-BA, hr-HR, hsb, hsb-DE, hu, hu-HU, hy, hy-AM, id, id-ID, ig, ig-NG, ii, ii-CN, is, is-IS, it, it-CH, it-IT, it-SM, ja, ja-JP, jgo, jgo-CM, jmc, jmc-TZ, ka, ka-GE, kab, kab-DZ, kam, kam-KE, kde, kde-TZ, kea, kea-CV, khq, khq-ML, ki, ki-KE, kk, kk-KZ, kkj, kkj-CM, kl, kl-GL, kln, kln-KE, km, km-KH, kn, kn-IN, ko, ko-KP, ko-KR, kok, kok-IN, ks, ks-IN, ksb, ksb-TZ, ksf, ksf-CM, ksh, ksh-DE, kw, kw-GB, ky, ky-KG, lag, lag-TZ, lb, lb-LU, lg, lg-UG, lkt, lkt-US, ln, ln-AO, ln-CD, ln-CF, ln-CG, lo, lo-LA, lrc, lrc-IQ, lrc-IR, lt, lt-LT, lu, lu-CD, luo, luo-KE, luy, luy-KE, lv, lv-LV, mas, mas-KE, mas-TZ, mer, mer-KE, mfe, mfe-MU, mg, mg-MG, mgh, mgh-MZ, mgo, mgo-CM, mk, mk-MK, ml, ml-IN, mn, mn-MN, mr, mr-IN, ms, ms-BN, ms-MY, ms-SG, mt, mt-MT, mua, mua-CM, my, my-MM, mzn, mzn-IR, naq, naq-NA, nb, nb-NO, nb-SJ, nd, nd-ZW, ne, ne-IN, ne-NP, nl, nl-AW, nl-BE, nl-BQ, nl-CW, nl-NL, nl-SR, nl-SX, nmg, nmg-CM, nn, nn-NO, nnh, nnh-CM, nus, nus-SS, nyn, nyn-UG, om, om-ET, om-KE, or, or-IN, os, os-GE, os-RU, pa, pa-Arab, pa-Arab-PK, pa-Guru, pa-Guru-IN, pl, pl-PL, prg, prg-001, ps, ps-AF, pt, pt-AO, pt-BR, pt-CV, pt-GW, pt-MO, pt-MZ, pt-PT, pt-ST, pt-TL, qu, qu-BO, qu-EC, qu-PE, rm, rm-CH, rn, rn-BI, ro, ro-MD, ro-RO, rof, rof-TZ, root, ru, ru-BY, ru-KG, ru-KZ, ru-MD, ru-RU, ru-UA, rw, rw-RW, rwk, rwk-TZ, sah, sah-RU, saq, saq-KE, sbp, sbp-TZ, se, se-FI, se-NO, se-SE, seh, seh-MZ, ses, ses-ML, sg, sg-CF, shi, shi-Latn, shi-Latn-MA, shi-Tfng, shi-Tfng-MA, si, si-LK, sk, sk-SK, sl, sl-SI, smn, smn-FI, sn, sn-ZW, so, so-DJ, so-ET, so-KE, so-SO, sq, sq-AL, sq-MK, sq-XK, sr, sr-Cyrl, sr-Cyrl-BA, sr-Cyrl-ME, sr-Cyrl-RS, sr-Cyrl-XK, sr-Latn, sr-Latn-BA, sr-Latn-ME, sr-Latn-RS, sr-Latn-XK, sv, sv-AX, sv-FI, sv-SE, sw, sw-CD, sw-KE, sw-TZ, sw-UG, ta, ta-IN, ta-LK, ta-MY, ta-SG, te, te-IN, teo, teo-KE, teo-UG, th, th-TH, ti, ti-ER, ti-ET, tk, tk-TM, to, to-TO, tr, tr-CY, tr-TR, twq, twq-NE, tzm, tzm-MA, ug, ug-CN, uk, uk-UA, ur, ur-IN, ur-PK, uz, uz-Arab, uz-Arab-AF, uz-Cyrl, uz-Cyrl-UZ, uz-Latn, uz-Latn-UZ, vai, vai-Latn, vai-Latn-LR, vai-Vaii, vai-Vaii-LR, vi, vi-VN, vo, vo-001, vun, vun-TZ, wae, wae-CH, xog, xog-UG, yav, yav-CM, yi, yi-001, yo, yo-BJ, yo-NG, zgh, zgh-MA, zh, zh-Hans, zh-Hans-CN, zh-Hans-HK, zh-Hans-MO, zh-Hans-SG, zh-Hant, zh-Hant-HK, zh-Hant-MO, zh-Hant-TW, zu, zu-ZA
    543 sv >> sv
    544 
    545 ** test: test8288
    546 
    547 @supported=it, en
    548 und >> it
    549 und, en >> en
    550 
    551 # examples from
    552 # http://unicode.org/repos/cldr/tags/latest/common/bcp47/
    553 # http://unicode.org/repos/cldr/tags/latest/common/validity/variant.xml
    554 
    555 @favor=script
    556 und >> it
    557 und, en >> en
    558 
    559 ** test: testUnHack
    560 
    561 @supported=en-NZ, en-IT
    562 en-US >> en-NZ
    563 
    564 @favor=script
    565 en-US >> en-NZ
    566 
    567 ** test: testEmptySupported => null
    568 en >> null
    569 
    570 # testVariantsAndExtensions
    571 
    572 ** test: tests the .combine() method
    573 
    574 @supported=und, fr
    575 fr-BE-fonipa >> fr | | fr-BE-fonipa
    576 @supported=und, fr-CA
    577 fr-BE-fonipa >> fr-CA | | fr-BE-fonipa
    578 @supported=und, fr-fonupa
    579 fr-BE-fonipa >> fr-fonupa | | fr-BE-fonipa
    580 @supported=und, no
    581 nn-BE-fonipa >> no | | no-BE-fonipa
    582 @supported=und, en-GB-u-sd-gbsct
    583 en-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin >> en-GB-u-sd-gbsct | | en-GB-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin
    584 
    585 @supported=en-PSCRACK, de-PSCRACK, fr-PSCRACK, pt-PT-PSCRACK
    586 fr-PSCRACK >> fr-PSCRACK
    587 fr >> en-PSCRACK
    588 de-CH >> en-PSCRACK
    589 
    590 @favor=script
    591 @supported=und, fr
    592 fr-BE-fonipa >> fr
    593 @supported=und, fr-CA
    594 fr-BE-fonipa >> fr-CA
    595 @supported=und, fr-fonupa
    596 fr-BE-fonipa >> fr-fonupa
    597 @supported=und, no
    598 nn-BE-fonipa >> no | | no-BE-fonipa
    599 @supported=und, en-GB-u-sd-gbsct
    600 en-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin >> en-GB-u-sd-gbsct | | en-GB-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin
    601 
    602 @supported=en-PSCRACK, de-PSCRACK, fr-PSCRACK, pt-PT-PSCRACK
    603 fr-PSCRACK >> fr-PSCRACK
    604 fr >> en-PSCRACK
    605 de-CH >> en-PSCRACK
    606 
    607 ** test: testClusters
    608 # we favor es-419 over others in cluster. Clusters: es- {ES, MA, EA} {419, AR, MX}
    609 
    610 @supported=und, es, es-MA, es-MX, es-419
    611 es-AR >> es-419
    612 @supported=und, es-MA, es, es-419, es-MX
    613 es-AR >> es-419
    614 @supported=und, es, es-MA, es-MX, es-419
    615 es-EA >> es
    616 @supported=und, es-MA, es, es-419, es-MX
    617 es-EA >> es
    618 
    619 # of course, fall back to within cluster
    620 
    621 @supported=und, es, es-MA, es-MX
    622 es-AR >> es-MX
    623 @supported=und, es-MA, es, es-MX
    624 es-AR >> es-MX
    625 @supported=und, es-MA, es-MX, es-419
    626 es-EA >> es-MA
    627 @supported=und, es-MA, es-419, es-MX
    628 es-EA >> es-MA
    629 
    630 # we favor es-GB over others in cluster. Clusters: en- {US, GU, VI} {GB, IN, ZA}
    631 
    632 @supported=und, en, en-GU, en-IN, en-GB
    633 en-ZA >> en-GB
    634 @supported=und, en-GU, en, en-GB, en-IN
    635 en-ZA >> en-GB
    636 @supported=und, en, en-GU, en-IN, en-GB
    637 en-VI >> en
    638 @supported=und, en-GU, en, en-GB, en-IN
    639 en-VI >> en
    640 
    641 # of course, fall back to within cluster
    642 
    643 @supported=und, en, en-GU, en-IN
    644 en-ZA >> en-IN
    645 @supported=und, en-GU, en, en-IN
    646 en-ZA >> en-IN
    647 @supported=und, en-GU, en-IN, en-GB
    648 en-VI >> en-GU
    649 @supported=und, en-GU, en-GB, en-IN
    650 en-VI >> en-GU
    651 
    652 @favor=script
    653 @supported=und, es, es-MA, es-MX, es-419
    654 es-AR >> es-419
    655 @supported=und, es-MA, es, es-419, es-MX
    656 es-AR >> es-419
    657 @supported=und, es, es-MA, es-MX, es-419
    658 es-EA >> es
    659 @supported=und, es-MA, es, es-419, es-MX
    660 es-EA >> es
    661 
    662 @supported=und, es, es-MA, es-MX
    663 es-AR >> es-MX
    664 @supported=und, es-MA, es, es-MX
    665 es-AR >> es-MX
    666 @supported=und, es-MA, es-MX, es-419
    667 es-EA >> es-MA
    668 @supported=und, es-MA, es-419, es-MX
    669 es-EA >> es-MA
    670 
    671 @supported=und, en, en-GU, en-IN, en-GB
    672 en-ZA >> en-GB
    673 @supported=und, en-GU, en, en-GB, en-IN
    674 en-ZA >> en-GB
    675 @supported=und, en, en-GU, en-IN, en-GB
    676 en-VI >> en
    677 @supported=und, en-GU, en, en-GB, en-IN
    678 en-VI >> en
    679 
    680 @supported=und, en, en-GU, en-IN
    681 en-ZA >> en-IN
    682 @supported=und, en-GU, en, en-IN
    683 en-ZA >> en-IN
    684 @supported=und, en-GU, en-IN, en-GB
    685 en-VI >> en-GU
    686 @supported=und, en-GU, en-GB, en-IN
    687 en-VI >> en-GU
    688 
    689 ** test: testThreshold
    690 @supported=50, und, fr-CA-fonupa
    691 @threshold=60
    692 fr-BE-fonipa >> fr-CA-fonupa | | fr-BE-fonipa
    693 @supported=und, fr-Cyrl-CA-fonupa
    694 fr-BE-fonipa >> fr-Cyrl-CA-fonupa | | fr-Cyrl-BE-fonipa
    695 @threshold=50
    696 fr-BE-fonipa >> und
    697 
    698 @favor=script
    699 @supported=50, und, fr-CA-fonupa
    700 @threshold=
    701 fr-BE-fonipa >> fr-CA-fonupa | | fr-BE-fonipa
    702 @supported=und, fr-Cyrl-CA-fonupa
    703 fr-BE-fonipa >> und
    704 
    705 ** test: testScriptFirst
    706 @supported=ru, fr
    707 zh, pl >> ru
    708 zh-Cyrl, pl >> ru
    709 @supported=hr, en-Cyrl
    710 sr >> hr
    711 @supported=da, ru, hr
    712 sr >> da
    713 
    714 @favor=script
    715 @supported=ru, fr
    716 zh, pl >> fr
    717 zh-Cyrl, pl >> ru
    718 @supported=hr, en-Cyrl
    719 sr >> en-Cyrl
    720 @supported=da, ru, hr
    721 sr >> ru
    722 
    723 ## III
    724 
    725 ** test: testBasicsWithDefault
    726 @supported=en-GB, en
    727 @default=fr
    728 en-GB >> en-GB
    729 en-US >> en
    730 fr >> fr
    731 ja >> fr
    732 
    733 @favor=script
    734 en-GB >> en-GB
    735 en-US >> en
    736 fr >> en
    737 ja >> fr
    738 
    739 ** test: testEmptyWithDefault
    740 @default=en
    741 fr >> en
    742 
    743 ** test: testGetBestMatchForList_exactMatch
    744 @supported=fr, en-GB, ja, es-ES, es-MX
    745 ja, de >> ja
    746 
    747 ** test: testGetBestMatchForList_simpleVariantMatch
    748 # Intentionally avoiding a perfect-match or two candidates for variant matches.
    749 @supported=fr, en-GB, ja, es-ES, es-MX
    750 de, en-US >> en-GB
    751 # Fall back.
    752 de, zh >> fr
    753 
    754 ** test: TestEuHack
    755 @supported=en-NZ, en-IT
    756 en-US >> en-NZ
    757 
    758 ** test: TestBasics
    759 @supported=fr, en-GB, en
    760 en-GB >> en-GB
    761 en-US >> en
    762 fr-FR >> fr
    763 ja-JP >> fr
    764 zu >> en
    765 # For a language that doesn't match anything, return the default.
    766 zxx >> fr
    767 
    768 @favor=script
    769 en-GB >> en-GB
    770 en-US >> en
    771 fr-FR >> fr
    772 ja-JP >> fr
    773 zu >> en
    774 zxx >> en
    775 
    776 ** test: TestExactMatch
    777 @supported=fr, en-GB, ja, es-ES, es-MX
    778 ja, de >> ja
    779 
    780 ** test: TestSimpleVariantMatch
    781 @supported=fr, en-GB, ja, es-ES, es-MX
    782 de, en-US >> en-GB
    783 de, zh >> fr
    784 
    785 ** test: TestMatchOnMaximized
    786 # ja-JP matches ja on likely subtags, and it's listed first, thus it wins
    787 # over the secondary preference en-GB.
    788 @supported=fr, en-GB, ja, es-ES, es-MX
    789 ja-JP, en-GB >> ja
    790 # Check that if the preference is maximized already, it works as well.
    791 ja-Jpan-JP, en-GB >> ja
    792 @supported=fr, zh-Hant, en
    793 zh, en >> en
    794 
    795 @favor=script
    796 zh, en >> en
    797 
    798 ** test: TestCloseEnoughMatchOnMaximized
    799 @supported=en-GB, en, de, fr, ja
    800 de-CH, fr >> de
    801 en-US, ar, nl, de, ja >> en
    802 
    803 ** test: TestGetBestMatchForPortuguese
    804 # 1. a supported set containing an explicit pt: {pt-PT, pt-BR, es, es-419}
    805 # 2. a supported set containing an implicit pt: {pt-PT, pt, es, es-419}
    806 # 3. a supported set containing no pt: {pt-BR, es, es-419}
    807 # European user who prefers Spanish over Brazilian Portuguese as a fallback.
    808 @supported=pt-PT, pt-BR, es, es-419
    809 pt-PT, es, pt >> pt-PT
    810 @supported=pt-PT, pt, es, es-419
    811 pt-PT, es, pt >> pt-PT
    812 @supported=pt-BR, es, es-419
    813 pt-PT, es, pt >> pt-BR
    814 
    815 # Brazilian user who prefers South American Spanish over European Portuguese
    816 # as a fallback. The asymmetry between this case and above is because it's
    817 # "pt-PT" that's missing between the matchers.
    818 @supported=pt-PT, pt-BR, es, es-419
    819 pt, es-419, pt-PT >> pt-BR
    820 @supported=pt-PT, pt, es, es-419
    821 pt, es-419, pt-PT >> pt
    822 @supported=pt-BR, es, es-419
    823 pt, es-419, pt-PT >> pt-BR
    824 
    825 # Sometimes we get "pt-US" for a user's language (which CLDR doesn't
    826 # recognize) but we deal with that as a synonym for "pt-BR".
    827 @supported=pt-PT, pt-BR, es, es-419
    828 pt-US, pt-PT >> pt-BR
    829 @supported=pt-PT, pt, es, es-419
    830 pt-US, pt-PT >> pt
    831 
    832 @favor=script
    833 @supported=pt-BR, es, es-419
    834 pt-PT, es, pt >> pt-BR
    835 @supported=pt-PT, pt, es, es-419
    836 pt-US, pt-PT >> pt
    837 
    838 ** test: TestScriptAndRegion
    839 @supported=en-GB, en
    840 en-CA >> en
    841 # fr-CA is a "close enough" match to "fr" to be returned in favor of "en-GB"
    842 @supported=fr, en-GB, en
    843 fr-CA, en-CA >> fr
    844 @supported=zh-Hant, zh-TW
    845 zh-HK >> zh-Hant
    846 
    847 @favor=script
    848 @supported=en-GB, en
    849 en-CA >> en
    850 @supported=fr, en-GB, en
    851 fr-CA, en-CA >> fr
    852 @supported=zh-Hant, zh-TW
    853 zh-HK >> zh-Hant
    854 
    855 ** test: TestFallback
    856 @supported=zh-CN, zh-TW, iw
    857 zh-Hant >> zh-TW
    858 zh >> zh-CN
    859 zh-Hans-CN >> zh-CN
    860 zh-Hant-HK >> zh-TW
    861 he-IT >> iw
    862 
    863 ** test: TestFallbackWithDefault
    864 # Check that script fallbacks are handled right and that we don't have to
    865 # fall back to the default.
    866 @supported=zh-CN, zh-TW, iw
    867 @default=fr
    868 zh-Hant >> zh-TW
    869 zh >> zh-CN
    870 zh-Hans-CN >> zh-CN
    871 zh-Hant-HK >> zh-TW
    872 he-IT >> iw
    873 
    874 @favor=script
    875 zh-Hant >> zh-TW
    876 zh >> zh-CN
    877 zh-Hans-CN >> zh-CN
    878 zh-Hant-HK >> zh-TW
    879 he-IT >> iw
    880 
    881 ** test: TestSpecials
    882 # Check that nearby languages are handled.
    883 @supported=en, fil, ro, nn
    884 tl >> fil
    885 mo >> ro
    886 nb >> nn
    887 ja >> en # Make sure default works.
    888 
    889 ** test: TestRegionalSpecials
    890 # Verify that en-AU is closer to en-GB than to en (which is en-US).
    891 @supported=en, en-GB, es-ES, es-419
    892 en-AU >> en-GB
    893 # Following 2 cases test closer/smaller region difference.
    894 es-MX >> es-419
    895 es-PT >> es-ES
    896 
    897 @favor=script
    898 en-AU >> en-GB
    899 es-MX >> es-419
    900 es-PT >> es-ES
    901 
    902 ** test: TestEmpty
    903 fr >> null
    904 
    905 ** test: TestUndefined
    906 # When the undefined language doesn't match anything in the list,
    907 # return the default.
    908 @supported=it, fr
    909 und >> it
    910 # When it *does* occur in the list, return it.
    911 @supported=it, und
    912 und >> und
    913 # The unusual part:
    914 # max("und") = "en-Latn-US", and since matching is based on
    915 # maximized tags, the undefined language would normally match
    916 # English.  But that would produce the counterintuitive results
    917 # that BestMatchFor("und", LanguageMatcher("it,en")) would be "en",
    918 # and BestMatchFor("en", LanguageMatcher("it,und")) would be "und".
    919 
    920 # To avoid that, we change the matcher's definitions of max
    921 # (AddLikelySubtagsWithDefaults) so that max("und")="und". That
    922 # produces the following, more desirable results:
    923 @supported=it, en
    924 und >> it
    925 @supported=it, und
    926 en >> it
    927 
    928 ** test: TestVariantWithScriptMatch
    929 @supported=fr, en, sv
    930 en-GB >> en
    931 en-GB, sv >> en
    932 
    933 @favor=script
    934 en-GB, sv >> en
    935 
    936 ** test: Serbian
    937 @supported=und, sr
    938 sr-ME >> sr
    939 @supported=und, sr-ME
    940 sr >> sr-ME
    941 @supported=und, sr-Latn
    942 bs >> und
    943 @supported=und, bs
    944 sr-Latn >> und
    945 @supported=und, sr
    946 bs >> und
    947 @supported=und, bs
    948 sr >> und
    949 @supported=und, sr-Latn
    950 sr >> sr-Latn
    951 @supported=und, sr
    952 sr-Latn >> sr
    953 
    954 @favor=script
    955 sr-ME >> sr
    956 @supported=und, sr-ME
    957 sr >> sr-ME
    958 @supported=und, sr-Latn
    959 bs >> sr-Latn
    960 @supported=und, bs
    961 sr-Latn >> bs
    962 @supported=und, sr
    963 bs >> und
    964 @supported=und, bs
    965 sr >> und
    966 @supported=und, sr-Latn
    967 sr >> sr-Latn
    968 @supported=und, sr
    969 sr-Latn >> sr
    970 
    971 ** test: MatchGooglePrivateUseSubtag
    972 @supported=fr, x-bork, en-Latn-US
    973 x-piglatin >> fr
    974 x-bork >> x-bork
    975 @supported=fr, en-GB, x-bork, es-ES, es-419
    976 x-piglatin >> fr
    977 x-bork >> x-bork
    978 
    979 @favor=script
    980 @supported=fr, x-bork, en-Latn-US
    981 x-piglatin >> x-bork
    982 x-bork >> x-bork
    983 @supported=fr, en-GB, x-bork, es-ES, es-419
    984 x-piglatin >> x-bork
    985 x-bork >> x-bork
    986 
    987 ** test: MatchLegacyCode
    988 @supported=fr, i-klingon, en-Latn-US
    989 en-GB-oed >> en-Latn-US
    990 i-klingon >> tlh
    991 
    992 @favor=script
    993 en-GB-oed >> en-Latn-US
    994 i-klingon >> tlh
    995 
    996 ** test: MatchGooglePseudoLocale
    997 # Google pseudo locales using variant subtags.
    998 # (See below for the region code based pseudo locales.)
    999 @supported=fr, en-PSACCENT, ar-PSBIDI, en-PSCRACK, zh-Hans-PSCRACK, pt-PT-PSCRACK, pt
   1000 de >> fr
   1001 en-US >> fr
   1002 en >> fr
   1003 ar-PSBIDI >> ar-PSBIDI
   1004 en-PSACCENT >> en-PSACCENT
   1005 en-PSCRACK >> en-PSCRACK
   1006 pt-BR >> pt
   1007 pt-PT-PSCRACK >> pt-PT-PSCRACK
   1008 zh-Hans-PSCRACK >> zh-Hans-PSCRACK
   1009 
   1010 @favor=script
   1011 de >> fr
   1012 en-US >> fr
   1013 en >> fr
   1014 ar-PSBIDI >> ar-PSBIDI
   1015 en-PSACCENT >> en-PSACCENT
   1016 en-PSCRACK >> en-PSCRACK
   1017 pt-BR >> pt
   1018 pt-PT-PSCRACK >> pt-PT-PSCRACK
   1019 zh-Hans-PSCRACK >> zh-Hans-PSCRACK
   1020 
   1021 ** test: MatchGooglePseudoLocaleWithFallbacks
   1022 # Pseudo locales based on the fall back option (XA..XC region codes).
   1023 @supported=fr, en-XA, ar-XB, en-XC, zh-Hans-XC, pt
   1024 de >> fr
   1025 en-US >> fr
   1026 en >> fr
   1027 ar-XB >> ar-XB
   1028 en-XA >> en-XA
   1029 en-XC >> en-XC
   1030 pt-BR >> pt
   1031 zh-Hans-XC >> zh-Hans-XC
   1032 
   1033 @favor=script
   1034 de >> fr
   1035 en-US >> fr
   1036 en >> fr
   1037 ar-XB >> ar-XB
   1038 en-XA >> en-XA
   1039 en-XC >> en-XC
   1040 pt-BR >> pt
   1041 zh-Hans-XC >> zh-Hans-XC
   1042 
   1043 ** test: DoNotMatchGooglePseudoLocale
   1044 @supported=fr, en-XA, ar-XB, en-PSACCENT, ar-PSBIDI, en-DE, pt, ar-SY, ar-PSCRACK
   1045 de >> fr
   1046 # We wouldn't want to return pseudo locales when there's a good match for an
   1047 # ordinary locale.
   1048 # Note: If LanguageMatcher was not aware of PSACCENT, it would consider the
   1049 # distance from "en" to "en-PSACCENT" smaller than to "en-DE" (the standard
   1050 # variant distance is smaller than a region distance).
   1051 en >> en-DE
   1052 ar-EG >> ar-SY
   1053 pt-BR >> pt
   1054 ar-XB >> ar-XB
   1055 ar-PSBIDI >> ar-PSBIDI
   1056 en-XA >> en-XA
   1057 en-PSACCENT >> en-PSACCENT
   1058 ar-PSCRACK >> ar-PSCRACK
   1059 
   1060 @favor=script
   1061 de >> en-DE
   1062 en >> en-DE
   1063 ar-EG >> ar-SY
   1064 pt-BR >> pt
   1065 ar-XB >> ar-XB
   1066 ar-PSBIDI >> ar-PSBIDI
   1067 en-XA >> en-XA
   1068 en-PSACCENT >> en-PSACCENT
   1069 ar-PSCRACK >> ar-PSCRACK
   1070 
   1071 ** test: BestMatchForTraditionalChinese
   1072 # Scenario: An application that only supports Simplified Chinese (and some
   1073 # other languages), but does not support Traditional Chinese. zh-Hans-CN
   1074 # could be replaced with zh-CN, zh, or zh-Hans, it wouldn't make much of a
   1075 # difference.
   1076 # The script distance (simplified vs. traditional Han) is considered small
   1077 # enough to be an acceptable match. The regional difference is considered
   1078 # almost insignificant.
   1079 @supported=fr, zh-Hans-CN, en-US
   1080 zh-TW >> fr # no match so get first
   1081 zh-Hant >> fr # no match so get first
   1082 
   1083 # For geopolitical reasons, you might want to avoid a zh-Hant -> zh-Hans
   1084 # match. In this case, if zh-TW, zh-HK or a tag starting with zh-Hant is
   1085 # requested, you can change your call to getBestMatch to include a 2nd
   1086 # language preference. "en" is a better match since its distance to "en-US"
   1087 # is closer than the distance from "zh-TW" to "zh-CN" (script distance).
   1088 zh-TW, en >> en-US
   1089 zh-Hant-CN, en >> en-US
   1090 zh-Hans, en >> zh-Hans-CN
   1091 
   1092 ** test: MaxBeforeEquals
   1093 # Compare maximized forms of earlier items before testing equality
   1094 # of later items.
   1095 @supported=en, fr-CA
   1096 en-US, fr-CA >> en
   1097 
   1098 @favor=script
   1099 en-US, fr-CA >> en
   1100 
   1101 ** test: SiblingDefaultRegion
   1102 @supported=de-AT, de-DE, de-CH
   1103 de >> de-DE
   1104 
   1105 ** test: ReturnDefaultInsteadOfNullForEmptyPriorityList
   1106 @default=und
   1107 de >> und
   1108 
   1109 ** test: ReturnSpecifiedDefaultForNoMatch
   1110 @supported=de, en, fr
   1111 @default=und
   1112 hi >> und
   1113 
   1114 @favor=script
   1115 hi >> und
   1116 
   1117 ** test: MatchedLanguageIgnoresDefault
   1118 @supported=de, en, fr
   1119 @default=und
   1120 fr >> fr
   1121 
   1122 @favor=script
   1123 fr >> fr
   1124 
   1125 ## GenX
   1126 
   1127 ** test: TwoSpanishes
   1128 @supported=es, es-MX
   1129 @default=und
   1130 es-001 >> es
   1131 und >> und
   1132 ca >> es
   1133 gl-ES >> es
   1134 es >> es
   1135 es-MX >> es-MX
   1136 es-002 >> es
   1137 es-003 >> es-MX
   1138 es-005 >> es-MX
   1139 es-019 >> es-MX
   1140 es-029 >> es-MX
   1141 es-419 >> es-MX
   1142 es-142 >> es
   1143 es-150 >> es
   1144 es-AD >> es
   1145 es-AR >> es-MX
   1146 es-BO >> es-MX
   1147 es-BZ >> es-MX
   1148 es-CA >> es-MX
   1149 es-CL >> es-MX
   1150 es-CO >> es-MX
   1151 es-CR >> es-MX
   1152 es-CU >> es-MX
   1153 es-DO >> es-MX
   1154 es-EC >> es-MX
   1155 es-ES >> es
   1156 es-GI >> es
   1157 es-GQ >> es
   1158 es-GT >> es-MX
   1159 es-HN >> es-MX
   1160 es-NI >> es-MX
   1161 es-PA >> es-MX
   1162 es-PE >> es-MX
   1163 es-PH >> es
   1164 es-PR >> es-MX
   1165 es-PY >> es-MX
   1166 es-SV >> es-MX
   1167 es-US >> es-MX
   1168 es-UY >> es-MX
   1169 es-VE >> es-MX
   1170 
   1171 @favor=script
   1172 es-001 >> es
   1173 und >> und
   1174 ca >> es
   1175 gl-ES >> es
   1176 es >> es
   1177 es-MX >> es-MX
   1178 es-002 >> es
   1179 es-003 >> es-MX
   1180 es-005 >> es-MX
   1181 es-019 >> es-MX
   1182 es-029 >> es-MX
   1183 es-419 >> es-MX
   1184 es-142 >> es
   1185 es-150 >> es
   1186 es-AD >> es
   1187 es-AR >> es-MX
   1188 es-BO >> es-MX
   1189 es-BZ >> es-MX
   1190 es-CA >> es-MX
   1191 es-CL >> es-MX
   1192 es-CO >> es-MX
   1193 es-CR >> es-MX
   1194 es-CU >> es-MX
   1195 es-DO >> es-MX
   1196 es-EC >> es-MX
   1197 es-ES >> es
   1198 es-GI >> es
   1199 es-GQ >> es
   1200 es-GT >> es-MX
   1201 es-HN >> es-MX
   1202 es-NI >> es-MX
   1203 es-PA >> es-MX
   1204 es-PE >> es-MX
   1205 es-PH >> es
   1206 es-PR >> es-MX
   1207 es-PY >> es-MX
   1208 es-SV >> es-MX
   1209 es-US >> es-MX
   1210 es-UY >> es-MX
   1211 es-VE >> es-MX
   1212 
   1213 ** test: Three Spanishes
   1214 @supported=es, es-419, es-MX
   1215 @default=und
   1216 es-001 >> es
   1217 und >> und
   1218 ca >> es
   1219 gl-ES >> es
   1220 es >> es
   1221 es-419 >> es-419
   1222 es-002 >> es
   1223 es-003 >> es-419
   1224 es-005 >> es-419
   1225 es-019 >> es-419
   1226 es-029 >> es-419
   1227 es-142 >> es
   1228 es-150 >> es
   1229 es-AD >> es
   1230 es-AR >> es-419
   1231 es-BO >> es-419
   1232 es-BZ >> es-419
   1233 es-CA >> es-419
   1234 es-CL >> es-419
   1235 es-CO >> es-419
   1236 es-CR >> es-419
   1237 es-CU >> es-419
   1238 es-DO >> es-419
   1239 es-EC >> es-419
   1240 es-ES >> es
   1241 es-GI >> es
   1242 es-GQ >> es
   1243 es-GT >> es-419
   1244 es-HN >> es-419
   1245 es-MX >> es-MX
   1246 es-NI >> es-419
   1247 es-PA >> es-419
   1248 es-PE >> es-419
   1249 es-PH >> es
   1250 es-PR >> es-419
   1251 es-PY >> es-419
   1252 es-SV >> es-419
   1253 es-US >> es-419
   1254 es-UY >> es-419
   1255 es-VE >> es-419
   1256 
   1257 @favor=script
   1258 es-001 >> es
   1259 und >> und
   1260 ca >> es
   1261 gl-ES >> es
   1262 es >> es
   1263 es-419 >> es-419
   1264 es-002 >> es
   1265 es-003 >> es-419
   1266 es-005 >> es-419
   1267 es-019 >> es-419
   1268 es-029 >> es-419
   1269 es-142 >> es
   1270 es-150 >> es
   1271 es-AD >> es
   1272 es-AR >> es-419
   1273 es-BO >> es-419
   1274 es-BZ >> es-419
   1275 es-CA >> es-419
   1276 es-CL >> es-419
   1277 es-CO >> es-419
   1278 es-CR >> es-419
   1279 es-CU >> es-419
   1280 es-DO >> es-419
   1281 es-EC >> es-419
   1282 es-ES >> es
   1283 es-GI >> es
   1284 es-GQ >> es
   1285 es-GT >> es-419
   1286 es-HN >> es-419
   1287 es-MX >> es-MX
   1288 es-NI >> es-419
   1289 es-PA >> es-419
   1290 es-PE >> es-419
   1291 es-PH >> es
   1292 es-PR >> es-419
   1293 es-PY >> es-419
   1294 es-SV >> es-419
   1295 es-US >> es-419
   1296 es-UY >> es-419
   1297 es-VE >> es-419
   1298 
   1299 ** test: Englishes
   1300 @supported=en-GB, en-US
   1301 @default=und
   1302 und >> und
   1303 ja >> und
   1304 fr-CA >> und
   1305 
   1306 # Great Britain fallback
   1307 en-AU >> en-GB
   1308 en-BZ >> en-GB
   1309 en-IN >> en-GB
   1310 en-IE >> en-GB
   1311 en-JM >> en-GB
   1312 en-NZ >> en-GB
   1313 en-PK >> en-GB
   1314 en-TT >> en-GB
   1315 en-ZA >> en-GB
   1316 
   1317 # United States fallback
   1318 en-CA >> en-US
   1319 en-US >> en-US
   1320 en >> en-US
   1321 
   1322 @favor=script
   1323 und >> und
   1324 ja >> und
   1325 fr-CA >> en-US
   1326 en-AU >> en-GB
   1327 en-BZ >> en-GB
   1328 en-CA >> en-US
   1329 en-IN >> en-GB
   1330 en-IE >> en-GB
   1331 en-JM >> en-GB
   1332 en-NZ >> en-GB
   1333 en-PK >> en-GB
   1334 en-TT >> en-GB
   1335 en-ZA >> en-GB
   1336 en-US >> en-US
   1337 en >> en-US
   1338 
   1339 ** test: TestFallback
   1340 # manyEnMatcher
   1341 @supported=en-GB, en-US, en, en-AU
   1342 @default=und
   1343 und >> und
   1344 ja >> und
   1345 fr-CA >> und
   1346 
   1347 # nonUsMatcher
   1348 fr >> und
   1349 
   1350 # onlyAuMatcher
   1351 @supported=en-AU, ja, ca
   1352 fr >> und
   1353 
   1354 # noEnMatcher
   1355 @supported=pl, ja, ca
   1356 fr >> und
   1357 
   1358 @favor=script
   1359 @supported=en-GB, en-US, en, en-AU
   1360 und >> und
   1361 ja >> und
   1362 fr-CA >> en-US
   1363 fr >> en-US
   1364 @supported=en-AU, ja, ca
   1365 fr >> en-AU
   1366 @supported=pl, ja, ca
   1367 fr >> pl
   1368 
   1369 ## Go
   1370 
   1371 ** test: basics
   1372 @supported=fr, en-GB, en
   1373 en-GB >> en-GB
   1374 en-US >> en
   1375 fr-FR >> fr
   1376 ja-JP >> fr
   1377 
   1378 ** test: script fallbacks
   1379 @supported=zh-CN, zh-TW, iw
   1380 zh-Hant >> zh-TW
   1381 zh >> zh-CN
   1382 zh-Hans-CN >> zh-CN
   1383 zh-Hant-HK >> zh-TW
   1384 @default=iw
   1385 he-IT >> iw
   1386 
   1387 @favor=script
   1388 he-IT >> iw
   1389 
   1390 ** test: language-specific script fallbacks 1
   1391 @supported=en, sr, nl
   1392 sr-Latn >> sr
   1393 sh >> en
   1394 hr >> en
   1395 bs >> en
   1396 nl-Cyrl >> en # Mark: Expected value should be en not sr. Script difference exceeds threshold, so can't be nl
   1397 
   1398 @favor=script
   1399 sr-Latn >> sr
   1400 hr >> en
   1401 bs >> en
   1402 nl-Cyrl >> sr
   1403 
   1404 ** test: language-specific script fallbacks 2
   1405 @supported=en, sr-Latn
   1406 sr >> sr-Latn
   1407 sr-Cyrl >> sr-Latn
   1408 @default=und
   1409 hr >> und
   1410 
   1411 @favor=script
   1412 @default=
   1413 sr >> sr-Latn
   1414 sr-Cyrl >> sr-Latn
   1415 @default=und
   1416 hr >> en
   1417 
   1418 ** test: don't match hr to sr-Latn
   1419 @supported=en, sr-Latn
   1420 hr >> en
   1421 
   1422 @favor=script
   1423 hr >> en
   1424 
   1425 ** test: both deprecated and not
   1426 @supported=fil, tl, iw, he
   1427 he-IT >> iw
   1428 he >> iw
   1429 iw >> iw
   1430 fil-IT >> fil
   1431 fil >> fil
   1432 tl >> fil
   1433 
   1434 @favor=script
   1435 he-IT >> iw
   1436 he >> iw
   1437 iw >> iw
   1438 fil-IT >> fil
   1439 fil >> fil
   1440 tl >> fil
   1441 
   1442 ** test: nearby languages: Nynorsk to Bokmål
   1443 @supported=en, nb
   1444 nn >> nb
   1445 
   1446 @favor=script
   1447 nn >> nb
   1448 
   1449 ** test: nearby languages: Danish does not match nn
   1450 @supported=en, nn
   1451 da >> en
   1452 
   1453 @favor=script
   1454 da >> en
   1455 
   1456 ** test: nearby languages: Danish matches no
   1457 @supported=en, no
   1458 da >> no
   1459 
   1460 @favor=script
   1461 da >> no
   1462 
   1463 ** test: nearby languages: Danish matches nb
   1464 @supported=en, nb
   1465 da >> nb
   1466 
   1467 ** test: prefer matching languages over language variants. Get en-GB, should get nn?
   1468 @supported=nn, en-GB
   1469 no, en-US >> en-GB
   1470 nb, en-US >> en-GB
   1471 
   1472 @favor=script
   1473 no, en-US >> nn
   1474 nb, en-US >> nn
   1475 
   1476 ** test: deprecated version is closer than same language with other differences
   1477 @supported=nl, he, en-GB
   1478 iw, en-US >> he
   1479 
   1480 @favor=script
   1481 iw, en-US >> he
   1482 
   1483 ** test: macro equivalent is closer than same language with other differences
   1484 @supported=nl, zh, en-GB, no
   1485 cmn, en-US >> zh
   1486 nb, en-US >> no
   1487 
   1488 @favor=script
   1489 cmn, en-US >> zh
   1490 nb, en-US >> no
   1491 
   1492 ** test: legacy equivalent is closer than same language with other differences
   1493 @supported=nl, fil, en-GB
   1494 tl, en-US >> fil
   1495 
   1496 @favor=script
   1497 tl, en-US >> fil
   1498 
   1499 ** test: distinguish near equivalents
   1500 @supported=en, ro, mo, ro-MD
   1501 ro >> ro
   1502 mo >> ro # ro=mo for the locale matcher
   1503 ro-MD >> ro-MD
   1504 
   1505 @favor=script
   1506 ro >> ro
   1507 mo >> ro # ro=mo for the locale matcher
   1508 ro-MD >> ro-MD
   1509 
   1510 ** test: maximization of legacy
   1511 @supported=sr-Cyrl, sr-Latn, ro, ro-MD
   1512 sh >> sr-Latn
   1513 mo >> ro
   1514 
   1515 @favor=script
   1516 sh >> sr-Latn
   1517 mo >> ro
   1518 
   1519 ** test: empty
   1520 fr >> null
   1521 en >> null
   1522 
   1523 ** test: private use subtags
   1524 @supported=fr, en-GB, x-bork, es-ES, es-419
   1525 x-piglatin >> fr
   1526 x-bork >> x-bork
   1527 
   1528 ** test: legacy codes
   1529 @supported=fr, i-klingon, en-Latn-US
   1530 en-GB-oed >> en-Latn-US
   1531 i-klingon >> tlh
   1532 
   1533 
   1534 ** test: simple variant match
   1535 @supported=fr, en-GB, ja, es-ES, es-MX
   1536 de, en-US >> en-GB
   1537 de, zh >> fr
   1538 
   1539 ** test: best match for traditional Chinese
   1540 @supported=fr, zh-Hans-CN, en-US
   1541 zh-TW >> fr # no match so get first
   1542 zh-Hant >> fr # no match so get first
   1543 zh-TW, en >> en-US
   1544 zh-Hant-CN, en >> en-US
   1545 zh-Hans, en >> zh-Hans-CN
   1546 
   1547 ** test: return most originally similar among likely-subtags equivalent locales
   1548 @supported=af, af-Latn, af-Arab
   1549 af >> af
   1550 af-ZA >> af
   1551 af-Latn-ZA >> af-Latn
   1552 af-Latn >> af-Latn
   1553 
   1554 @favor=script
   1555 af >> af
   1556 af-ZA >> af
   1557 af-Latn-ZA >> af-Latn
   1558 af-Latn >> af-Latn
   1559 
   1560 @supported=nl, nl-NL, nl-BE
   1561 @favor=
   1562 nl >> nl
   1563 nl-Latn >> nl
   1564 nl-Latn-NL >> nl-NL
   1565 nl-NL >> nl-NL
   1566 
   1567 @favor=script
   1568 nl >> nl
   1569 nl-Latn >> nl
   1570 nl-Latn-NL >> nl-NL
   1571 nl-NL >> nl-NL
   1572 
   1573 @supported=nl, nl-Latn, nl-NL, nl-BE
   1574 @favor=
   1575 nl >> nl
   1576 nl-Latn >> nl-Latn
   1577 nl-NL >> nl-NL
   1578 nl-Latn-NL >> nl-Latn
   1579 
   1580 @favor=script
   1581 nl >> nl
   1582 nl-Latn >> nl-Latn
   1583 nl-NL >> nl-NL
   1584 nl-Latn-NL >> nl-Latn
   1585 
   1586 ** test: region may replace matched if matched is enclosing
   1587 @supported=es-419, es
   1588 @default=es-MX
   1589 es-MX >> es-419
   1590 @default=
   1591 es-SG >> es
   1592 
   1593 @favor=script
   1594 @default=es-MX
   1595 es-MX >> es-419
   1596 @default=
   1597 es-SG >> es
   1598 
   1599 ** test: region distance Portuguese
   1600 @supported=pt, pt-PT
   1601 pt-ES >> pt-PT
   1602 
   1603 @favor=script
   1604 pt-ES >> pt-PT
   1605 
   1606 ** test: if no preferred locale specified, pick top language, not regional
   1607 @supported=en, fr, fr-CA, fr-CH
   1608 fr-US >> fr
   1609 
   1610 @favor=script
   1611 fr-US >> fr
   1612 
   1613 ** test: region distance German
   1614 @supported=de-AT, de-DE, de-CH
   1615 de >> de-DE
   1616 
   1617 ** test: en-AU is closer to en-GB than to en (which is en-US)
   1618 @supported=en, en-GB, es-ES, es-419
   1619 en-AU >> en-GB
   1620 @default=es-MX
   1621 es-MX >> es-419
   1622 @default=
   1623 es-PT >> es-ES
   1624 
   1625 @favor=script
   1626 en-AU >> en-GB
   1627 es-MX >> es-419
   1628 @default=
   1629 es-PT >> es-ES
   1630 
   1631 ** test: undefined
   1632 @supported=it, fr
   1633 und >> it
   1634 
   1635 ** test: und does not match en
   1636 @supported=it, en
   1637 und >> it
   1638 
   1639 ** test: undefined in priority list
   1640 @supported=it, und
   1641 und >> und
   1642 en >> it
   1643 
   1644 ** test: undefined
   1645 @supported=it, fr, zh
   1646 und-FR >> fr
   1647 und-CN >> zh
   1648 und-Hans >> zh
   1649 und-Hant >> it # no match so get first
   1650 und-Latn >> it
   1651 
   1652 @favor=script
   1653 und-FR >> fr
   1654 und-CN >> zh
   1655 und-Hans >> zh
   1656 und-Hant >> it # no match so get first
   1657 und-Latn >> it
   1658 
   1659 ** test: match on maximized tag
   1660 @supported=fr, en-GB, ja, es-ES, es-MX
   1661 ja-JP, en-GB >> ja
   1662 ja-Jpan-JP, en-GB >> ja
   1663 
   1664 ** test: pick best maximized tag
   1665 @supported=ja, ja-Jpan-US, ja-JP, en, ru
   1666 ja-Jpan, ru >> ja
   1667 ja-JP, ru >> ja-JP
   1668 ja-US, ru >> ja-Jpan-US
   1669 
   1670 @favor=script
   1671 ja-Jpan, ru >> ja
   1672 ja-JP, ru >> ja-JP
   1673 ja-US, ru >> ja-Jpan-US
   1674 
   1675 ** test: termination: pick best maximized match
   1676 @supported=ja, ja-Jpan, ja-JP, en, ru
   1677 ja-Jpan-JP, ru >> ja-Jpan
   1678 ja-Jpan, ru >> ja-Jpan
   1679 
   1680 @favor=script
   1681 ja-Jpan-JP, ru >> ja-Jpan
   1682 ja-Jpan, ru >> ja-Jpan
   1683 
   1684 ** test: same language over exact, but distinguish when user is explicit
   1685 @supported=fr, en-GB, ja, es-ES, es-MX
   1686 ja, de >> ja
   1687 @supported=en, de, fr, ja
   1688 de-CH, fr >> de
   1689 @supported=en-GB, nl
   1690 en, nl >> en-GB
   1691 en, nl, en-GB >> en-GB
   1692 
   1693 @favor=script
   1694 @supported=fr, en-GB, ja, es-ES, es-MX
   1695 ja, de >> ja
   1696 @supported=en, de, fr, ja
   1697 de-CH, fr >> de
   1698 @supported=en-GB, nl
   1699 en, nl >> en-GB
   1700 en, nl, en-GB >> en-GB
   1701 
   1702 ** test: parent relation preserved
   1703 @supported=en, en-US, en-GB, es, es-419, pt, pt-BR, pt-PT, zh, zh-Hant, zh-Hant-HK
   1704 en-150 >> en-GB
   1705 en-AU >> en-GB
   1706 en-BE >> en-GB
   1707 en-GG >> en-GB
   1708 en-GI >> en-GB
   1709 en-HK >> en-GB
   1710 en-IE >> en-GB
   1711 en-IM >> en-GB
   1712 en-IN >> en-GB
   1713 en-JE >> en-GB
   1714 en-MT >> en-GB
   1715 en-NZ >> en-GB
   1716 en-PK >> en-GB
   1717 en-SG >> en-GB
   1718 en-DE >> en-GB
   1719 @default=es-AR
   1720 es-AR >> es-419
   1721 @default=es-BO
   1722 es-BO >> es-419
   1723 @default=es-CL
   1724 es-CL >> es-419
   1725 @default=es-CO
   1726 es-CO >> es-419
   1727 @default=es-CR
   1728 es-CR >> es-419
   1729 @default=es-CU
   1730 es-CU >> es-419
   1731 @default=es-DO
   1732 es-DO >> es-419
   1733 @default=es-EC
   1734 es-EC >> es-419
   1735 @default=es-GT
   1736 es-GT >> es-419
   1737 @default=es-HN
   1738 es-HN >> es-419
   1739 @default=es-MX
   1740 es-MX >> es-419
   1741 @default=es-NI
   1742 es-NI >> es-419
   1743 @default=es-PA
   1744 es-PA >> es-419
   1745 @default=es-PE
   1746 es-PE >> es-419
   1747 @default=es-PR
   1748 es-PR >> es-419
   1749 @default=
   1750 es-PT >> es
   1751 @default=es-PY
   1752 es-PY >> es-419
   1753 @default=es-SV
   1754 es-SV >> es-419
   1755 @default=
   1756 es-US >> es-419
   1757 @default=es-UY
   1758 es-UY >> es-419
   1759 @default=es-VE
   1760 es-VE >> es-419
   1761 @default=
   1762 pt-AO >> pt-PT
   1763 pt-CV >> pt-PT
   1764 pt-GW >> pt-PT
   1765 pt-MO >> pt-PT
   1766 pt-MZ >> pt-PT
   1767 pt-ST >> pt-PT
   1768 pt-TL >> pt-PT
   1769 
   1770 @favor=script
   1771 en-150 >> en-GB
   1772 en-AU >> en-GB
   1773 en-BE >> en-GB
   1774 en-GG >> en-GB
   1775 en-GI >> en-GB
   1776 en-HK >> en-GB
   1777 en-IE >> en-GB
   1778 en-IM >> en-GB
   1779 en-IN >> en-GB
   1780 en-JE >> en-GB
   1781 en-MT >> en-GB
   1782 en-NZ >> en-GB
   1783 en-PK >> en-GB
   1784 en-SG >> en-GB
   1785 en-DE >> en-GB
   1786 @default=es-AR
   1787 es-AR >> es-419
   1788 @default=es-BO
   1789 es-BO >> es-419
   1790 @default=es-CL
   1791 es-CL >> es-419
   1792 @default=es-CO
   1793 es-CO >> es-419
   1794 @default=es-CR
   1795 es-CR >> es-419
   1796 @default=es-CU
   1797 es-CU >> es-419
   1798 @default=es-DO
   1799 es-DO >> es-419
   1800 @default=es-EC
   1801 es-EC >> es-419
   1802 @default=es-GT
   1803 es-GT >> es-419
   1804 @default=es-HN
   1805 es-HN >> es-419
   1806 @default=es-MX
   1807 es-MX >> es-419
   1808 @default=es-NI
   1809 es-NI >> es-419
   1810 @default=es-PA
   1811 es-PA >> es-419
   1812 @default=es-PE
   1813 es-PE >> es-419
   1814 @default=es-PR
   1815 es-PR >> es-419
   1816 @default=
   1817 es-PT >> es
   1818 @default=es-PY
   1819 es-PY >> es-419
   1820 @default=es-SV
   1821 es-SV >> es-419
   1822 @default=
   1823 es-US >> es-419
   1824 @default=es-UY
   1825 es-UY >> es-419
   1826 @default=es-VE
   1827 es-VE >> es-419
   1828 @default=
   1829 pt-AO >> pt-PT
   1830 pt-CV >> pt-PT
   1831 pt-GW >> pt-PT
   1832 pt-MO >> pt-PT
   1833 pt-MZ >> pt-PT
   1834 pt-ST >> pt-PT
   1835 pt-TL >> pt-PT
   1836 
   1837 ** test: preserve extensions
   1838 @supported=en, de, sl-NEDIS
   1839 @default=de-u-co-phonebk
   1840 de-FR-u-co-phonebk >> de
   1841 @default=sl-NEDIS-u-cu-eur
   1842 sl-NEDIS-u-cu-eur >> sl-NEDIS
   1843 sl-u-cu-eur >> sl-NEDIS
   1844 sl-HR-NEDIS-u-cu-eur >> sl-NEDIS
   1845 @default=de-t-m0-iso-i0-pinyin
   1846 de-t-m0-iso-i0-pinyin >> de
   1847 
   1848 @favor=script
   1849 @default=de-u-co-phonebk
   1850 de-FR-u-co-phonebk >> de
   1851 @default=sl-NEDIS-u-cu-eur
   1852 sl-NEDIS-u-cu-eur >> sl-NEDIS
   1853 sl-u-cu-eur >> sl-NEDIS
   1854 sl-HR-NEDIS-u-cu-eur >> sl-NEDIS
   1855 @default=de-t-m0-iso-i0-pinyin
   1856 de-t-m0-iso-i0-pinyin >> de
   1857 
   1858 ## ULS
   1859 
   1860 ** test: testEmptyUserLanguagesGetsEmpty_getBestMatches
   1861 @supported=de
   1862 >> de
   1863 
   1864 ** test: testNoStrongMatchGetsEmpty_getBestMatches
   1865 @supported=de
   1866 fr >> de
   1867 
   1868 @favor=script
   1869 fr >> de
   1870 
   1871 ** test: testLooseMatchForGeneral_getBestMatches
   1872 @supported=es-419
   1873 es-MX >> es-419
   1874 
   1875 @favor=script
   1876 es-MX >> es-419
   1877 
   1878 ** test: testLooseMatchForEnglish_getBestMatches
   1879 @supported=en, en-GB
   1880 en-CA >> en
   1881 
   1882 @favor=script
   1883 en-CA >> en
   1884 
   1885 ** test: testLooseMatchForChinese_getBestMatches
   1886 @supported=zh
   1887 zh-TW >> zh
   1888 
   1889 @favor=script
   1890 zh-TW >> zh
   1891 
   1892 ## Geo
   1893 
   1894 ** test: testGetBestMatchWithMinMatchScore
   1895 @supported=fr-FR, fr, fr-CA, en
   1896 @default=und
   1897 fr >> fr
   1898 @supported=en, fr, fr-CA
   1899 fr-FR >> fr # Parent match is chosen.
   1900 @supported=en, fr-CA
   1901 fr-FR >> fr-CA # Sibling match is chosen.
   1902 @supported=fr-CA, fr-FR
   1903 fr >> fr-FR # Inferred region match is chosen.
   1904 fr-SN >> fr-FR
   1905 @supported=en, fr-FR
   1906 fr >> fr-FR # Child match is chosen.
   1907 @supported=de, en, it
   1908 fr >> und
   1909 @supported=iw, en
   1910 iw-Latn >> und
   1911 @supported=iw, no
   1912 ru >> und
   1913 @supported=iw-Latn, iw-Cyrl, iw
   1914 ru >> und
   1915 @supported=iw, iw-Latn
   1916 ru >> und
   1917 en >> und
   1918 @supported=en, uk
   1919 ru >> und
   1920 @supported=zh-TW, en
   1921 zh-CN >> und # no match
   1922 @supported=ja
   1923 ru >> und
   1924 
   1925 @favor=script
   1926 @supported=fr-FR, fr, fr-CA, en
   1927 fr >> fr
   1928 @supported=en, fr, fr-CA
   1929 fr-FR >> fr
   1930 @supported=en, fr-CA
   1931 fr-FR >> fr-CA
   1932 @supported=fr-CA, fr-FR
   1933 fr >> fr-FR
   1934 fr-SN >> fr-FR
   1935 @supported=en, fr-FR
   1936 fr >> fr-FR
   1937 @supported=de, en, it
   1938 fr >> en
   1939 @supported=iw, en
   1940 iw-Latn >> en
   1941 @supported=iw, no
   1942 ru >> und
   1943 @supported=iw-Latn, iw-Cyrl, iw
   1944 ru >> iw-Cyrl
   1945 @supported=iw, iw-Latn
   1946 ru >> und
   1947 en >> iw-Latn
   1948 @supported=en, uk
   1949 ru >> uk
   1950 @supported=zh-TW, en
   1951 zh-CN >> und # no match
   1952 @supported=ja
   1953 ru >> und
   1954 
   1955 ** test: favor a more-default locale among equally imperfect matches
   1956 @supported=fr-CA, fr-CH, fr-FR, fr-GB
   1957 fr-SN >> fr-FR
   1958 @supported=sr-Latn, sr-Cyrl, sr-Grek
   1959 @threshold=60
   1960 sr-Thai >> sr-Cyrl