keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | es5id: 15.2.3.7-6-a-112 |
| 6 | description: > |
| 7 | Object.defineProperties - 'O' is an Array, test the length |
| 8 | property of 'O' is own data property (15.4.5.1 step 1) |
| 9 | ---*/ |
| 10 | |
| 11 | var arr = [0, 1]; |
| 12 | Object.defineProperty(arr, "1", { |
| 13 | value: 1, |
| 14 | configurable: false |
| 15 | }); |
| 16 | assert.throws(TypeError, function() { |
| 17 | Object.defineProperties(arr, { |
| 18 | length: { value: 1 } |
| 19 | }); |
| 20 | }); |
| 21 | var desc = Object.getOwnPropertyDescriptor(arr, "length"); |
| 22 | |
| 23 | assert.sameValue(desc.value, 2, 'desc.value'); |
| 24 | assert(desc.writable, 'desc.writable !== true'); |
| 25 | assert.sameValue(desc.enumerable, false, 'desc.enumerable'); |
| 26 | assert.sameValue(desc.configurable, false, 'desc.configurable'); |