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

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:4b30922258fc
1 // Copyright 2012 Mozilla Corporation. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
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 */
9
10 $INCLUDE("testIntl.js");
11
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 });
29
30 return true;
31 });
32

mercurial