js/src/tests/test262/intl402/ch09/9.2/9.2.8_4.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:3014738f8b67
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 the array returned by SupportedLocales is extensible,
6 * but its properties are non-writable/non-configurable.
7 * @author Norbert Lindenberg
8 */
9
10 $INCLUDE("testIntl.js");
11
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 }
21
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");
32
33 return true;
34 });
35

mercurial