js/src/tests/test262/intl402/ch09/9.2/9.2.6_4_c.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 LookupSupportedLocales includes the default locale
     6  *     and doesn't include the "no linguistic content" locale.
     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 defaultLocale = new Constructor().resolvedOptions().locale;
    16         var noLinguisticContent = "zxx";
    17         var supported = Constructor.supportedLocalesOf([defaultLocale, noLinguisticContent],
    18             {localeMatcher: matcher});
    19         if (supported.indexOf(defaultLocale) === -1) {
    20             $ERROR("SupportedLocales didn't return default locale with matcher " + matcher + ".");
    21         }
    22         if (supported.indexOf(noLinguisticContent) !== -1) {
    23             $ERROR("SupportedLocales returned the \"no linguistic content\" locale with matcher " + matcher + ".");
    24         }
    25         if (supported.length > 1) {
    26             $ERROR("SupportedLocales returned stray locales: " + supported.join(", ") + " with matcher " + matcher + ".");
    27         }
    28     });
    30     return true;
    31 });

mercurial