js/src/tests/test262/intl402/ch09/9.2/9.2.8_4.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 the array returned by SupportedLocales is extensible,
     6  *     but its properties are non-writable/non-configurable.
     7  * @author Norbert Lindenberg
     8  */
    10 $INCLUDE("testIntl.js");
    12 function testFrozenProperty(obj, property) {
    13     var desc = Object.getOwnPropertyDescriptor(obj, property);
    14     if (desc.writable) {
    15         $ERROR("Property " + property + " of object returned by SupportedLocales is writable.");
    16     }
    17     if (desc.configurable) {
    18         $ERROR("Property " + property + " of object returned by SupportedLocales is configurable.");
    19     }
    20 }
    22 testWithIntlConstructors(function (Constructor) {
    23     var defaultLocale = new Constructor().resolvedOptions().locale;
    24     var supported = Constructor.supportedLocalesOf([defaultLocale]);
    25     if (!Object.isExtensible(supported)) {
    26         $ERROR("Object returned by SupportedLocales is not extensible.");
    27     }
    28     for (var i = 0; i < supported.length; i++) {
    29         testFrozenProperty(supported, i);
    30     }
    31     testFrozenProperty(supported, "length");
    33     return true;
    34 });

mercurial