|
1 /// Copyright (c) 2012 Ecma International. All rights reserved. |
|
2 /// Ecma International makes this code available under the terms and conditions set |
|
3 /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the |
|
4 /// "Use Terms"). Any redistribution of this code must retain the above |
|
5 /// copyright and this notice and otherwise comply with the Use Terms. |
|
6 /** |
|
7 * Refer 11.1.4; |
|
8 * The production |
|
9 * ElementList : ElementList , Elisionopt AssignmentExpression |
|
10 * 6.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(ToUint32((pad+len)) and the Property Descriptor { [[Value]]: initValue |
|
11 * , [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. |
|
12 * |
|
13 * @path ch11/11.1/11.1.4/11.1.4_5-6-1.js |
|
14 * @description Initialize array using ElementList (ElementList , Elisionopt AssignmentExpression) when index property (read-only) exists in Array.prototype (step 6) |
|
15 */ |
|
16 |
|
17 |
|
18 function testcase() { |
|
19 try { |
|
20 Object.defineProperty(Array.prototype, "1", { |
|
21 value: 100, |
|
22 writable: false, |
|
23 configurable: true |
|
24 }); |
|
25 var arr = [101, 12]; |
|
26 |
|
27 return arr.hasOwnProperty("1") && arr[1] === 12; |
|
28 } finally { |
|
29 delete Array.prototype[1]; |
|
30 } |
|
31 } |
|
32 runTestCase(testcase); |