| 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.6-4-116 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, test the length property |
| 8 |
of 'O' is own data property (15.4.5.1 step 1) |
| 9 |
---*/ |
| 10 |
|
| 11 |
var arrObj = [0, 1]; |
| 12 |
Object.defineProperty(arrObj, "1", { |
| 13 |
value: 1, |
| 14 |
configurable: false |
| 15 |
}); |
| 16 |
|
| 17 |
assert.throws(TypeError, function() { |
| 18 |
Object.defineProperty(arrObj, "length", { |
| 19 |
value: 1 |
| 20 |
}); |
| 21 |
}); |
| 22 |
|
| 23 |
var desc = Object.getOwnPropertyDescriptor(arrObj, "length"); |
| 24 |
|
| 25 |
assert(Object.hasOwnProperty.call(arrObj, "length"), 'Object.hasOwnProperty.call(arrObj, "length")'); |
| 26 |
assert.sameValue(desc.value, 2, 'desc.value'); |
| 27 |
assert.sameValue(desc.writable, true, 'desc.writable'); |
| 28 |
assert.sameValue(desc.configurable, false, 'desc.configurable'); |
| 29 |
assert.sameValue(desc.enumerable, false, 'desc.enumerable'); |