js/src/tests/test262/intl402/ch09/9.2/9.2.6_4_b.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright 2012 Mozilla Corporation. All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * @description Tests that Unicode locale extension sequences do not affect
     6  *    whether a locale is considered supported, but are reported back.
     7  * @author Norbert Lindenberg
     8  */
    10 $INCLUDE("testIntl.js");
    12 testWithIntlConstructors(function (Constructor) {
    13     // this test should work equally for both matching algorithms
    14     ["lookup", "best fit"].forEach(function (matcher) {
    15         var info = getLocaleSupportInfo(Constructor);
    16         var allLocales = info.supported.concat(info.byFallback, info.unsupported);
    17         allLocales.forEach(function (locale) {
    18             var validExtension = "-u-co-phonebk-nu-latn";
    19             var invalidExtension = "-u-nu-invalid";
    20             var supported1 = Constructor.supportedLocalesOf([locale],
    21                 {localeMatcher: matcher});
    22             var supported2 = Constructor.supportedLocalesOf([locale + validExtension],
    23                 {localeMatcher: matcher});
    24             var supported3 = Constructor.supportedLocalesOf([locale + invalidExtension],
    25                 {localeMatcher: matcher});
    26             if (supported1.length === 1) {
    27                 if (supported2.length !== 1 || supported3.length !== 1) {
    28                     $ERROR("Presence of Unicode locale extension sequence affects whether locale " +
    29                         locale + " is considered supported with matcher " + matcher + ".");
    30                 }
    31                 if (supported2[0] !== locale + validExtension || supported3[0] !== locale + invalidExtension) {
    32                     alert(locale + "; " + supported2[0] + "; " + supported3[0]);
    33                     $ERROR("Unicode locale extension sequence is not correctly returned for locale " +
    34                         locale + " with matcher " + matcher + ".");
    35                 }
    36             } else {
    37                 if (supported2.length !== 0 || supported3.length !== 0) {
    38                     $ERROR("Presence of Unicode locale extension sequence affects whether locale " +
    39                         locale + " is considered supported with matcher " + matcher + ".");
    40                 }
    41             }
    42         });
    43     });
    45     return true;
    46 });

mercurial