js/src/tests/test262/intl402/ch11/11.2/11.2.2_a.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:210945985d92
1 // Copyright 2012 Google Inc. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /**
5 * @description Tests that Intl.NumberFormat has a supportedLocalesOf
6 * property, and it works as planned.
7 * @author: Roozbeh Pournader
8 */
9
10 var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
11 var notSupported = 'zxx'; // "no linguistic content"
12 var requestedLocales = [defaultLocale, notSupported];
13
14 var supportedLocales;
15
16 if (!Intl.NumberFormat.hasOwnProperty('supportedLocalesOf')) {
17 $ERROR("Intl.NumberFormat doesn't have a supportedLocalesOf property.");
18 }
19
20 supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
21 if (supportedLocales.length !== 1) {
22 $ERROR('The length of supported locales list is not 1.');
23 }
24
25 if (supportedLocales[0] !== defaultLocale) {
26 $ERROR('The default locale is not returned in the supported list.');
27 }
28

mercurial