| 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-218 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, 'name' is an array index |
| 8 |
property, test TypeError is thrown when the [[Value]] field of |
| 9 |
'desc' is +0, and the [[Value]] attribute value of 'name' is -0 |
| 10 |
(15.4.5.1 step 4.c) |
| 11 |
includes: [propertyHelper.js] |
| 12 |
---*/ |
| 13 |
|
| 14 |
var arrObj = []; |
| 15 |
|
| 16 |
Object.defineProperty(arrObj, "0", { |
| 17 |
value: -0 |
| 18 |
}); |
| 19 |
|
| 20 |
try { |
| 21 |
Object.defineProperty(arrObj, "0", { |
| 22 |
value: +0 |
| 23 |
}); |
| 24 |
$ERROR("Expected an exception."); |
| 25 |
} catch (e) { |
| 26 |
verifyEqualTo(arrObj, "0", -0); |
| 27 |
|
| 28 |
verifyNotWritable(arrObj, "0"); |
| 29 |
|
| 30 |
verifyNotEnumerable(arrObj, "0"); |
| 31 |
|
| 32 |
verifyNotConfigurable(arrObj, "0"); |
| 33 |
|
| 34 |
if (!(e instanceof TypeError)) { |
| 35 |
$ERROR("Expected TypeError, got " + e); |
| 36 |
} |
| 37 |
|
| 38 |
} |