Debian Codegraph @

js/src/tests/test262/intl402/supportedLocalesOf-default-locale-and-zxx-locale.js

raw
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 es5id: 9.2.6_4_c
6 description: >
7 Tests that LookupSupportedLocales includes the default locale and
8 doesn't include the "no linguistic content" locale.
9 author: Norbert Lindenberg
10 includes: [testIntl.js]
11 ---*/
12
13 testWithIntlConstructors(function (Constructor) {
14 // this test should work equally for both matching algorithms
15 ["lookup", "best fit"].forEach(function (matcher) {
16 var defaultLocale = new Constructor().resolvedOptions().locale;
17 var noLinguisticContent = "zxx";
18 var supported = Constructor.supportedLocalesOf([defaultLocale, noLinguisticContent],
19 {localeMatcher: matcher});
20 assert.notSameValue(supported.indexOf(defaultLocale), -1, "SupportedLocales didn't return default locale with matcher " + matcher + ".");
21 assert.sameValue(supported.indexOf(noLinguisticContent), -1, "SupportedLocales returned the \"no linguistic content\" locale with matcher " + matcher + ".");
22 assert.sameValue(supported.length > 1, false, "SupportedLocales returned stray locales: " + supported.join(", ") + " with matcher " + matcher + ".");
23 });
24 });
25
26 reportCompare(0, 0);