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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_a.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +// Copyright 2012 Google Inc.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * @description Tests that Intl.NumberFormat has a supportedLocalesOf
     1.9 + * property, and it works as planned.
    1.10 + * @author: Roozbeh Pournader
    1.11 + */
    1.12 +
    1.13 +var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
    1.14 +var notSupported = 'zxx'; // "no linguistic content"
    1.15 +var requestedLocales = [defaultLocale, notSupported];
    1.16 +    
    1.17 +var supportedLocales;
    1.18 +
    1.19 +if (!Intl.NumberFormat.hasOwnProperty('supportedLocalesOf')) {
    1.20 +    $ERROR("Intl.NumberFormat doesn't have a supportedLocalesOf property.");
    1.21 +}
    1.22 +    
    1.23 +supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
    1.24 +if (supportedLocales.length !== 1) {
    1.25 +    $ERROR('The length of supported locales list is not 1.');
    1.26 +}
    1.27 +    
    1.28 +if (supportedLocales[0] !== defaultLocale) {
    1.29 +    $ERROR('The default locale is not returned in the supported list.');
    1.30 +}
    1.31 +

mercurial