Debian Codegraph @

js/src/tests/test262/intl402/supportedLocalesOf-returned-array-elements-are-not-frozen.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.8_4
6 description: >
7 Tests that the array returned by SupportedLocales is extensible,
8 writable and configurable.
9 author: Norbert Lindenberg
10 includes: [testIntl.js]
11 ---*/
12
13 function testNormalProperty(obj, property) {
14 var desc = Object.getOwnPropertyDescriptor(obj, property);
15 assert.sameValue(desc.writable, true, "Property " + property + " of object returned by SupportedLocales is not writable.");
16 assert.sameValue(desc.configurable, true, "Property " + property + " of object returned by SupportedLocales is not configurable.");
17 }
18
19 function testLengthProperty(obj, property) {
20 var desc = Object.getOwnPropertyDescriptor(obj, property);
21 assert.sameValue(desc.writable, true, "Property " + property + " of object returned by SupportedLocales is not writable.");
22 assert.sameValue(desc.configurable, false, "Property " + property + " of object returned by SupportedLocales is configurable.");
23 }
24
25 testWithIntlConstructors(function (Constructor) {
26 var defaultLocale = new Constructor().resolvedOptions().locale;
27 var supported = Constructor.supportedLocalesOf([defaultLocale]);
28 assert(Object.isExtensible(supported), "Object returned by SupportedLocales is not extensible.");
29 for (var i = 0; i < supported.length; i++) {
30 testNormalProperty(supported, i);
31 }
32 testLengthProperty(supported, "length");
33 });
34
35 reportCompare(0, 0);