| 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-77 |
| 6 |
description: > |
| 7 |
Object.defineProperties throws TypeError when P.configurable is |
| 8 |
false, P.writalbe is false, properties.value is +0 and P.value is |
| 9 |
-0 (8.12.9 step 10.a.ii.1) |
| 10 |
includes: [propertyHelper.js] |
| 11 |
---*/ |
| 12 |
|
| 13 |
|
| 14 |
var obj = {}; |
| 15 |
|
| 16 |
Object.defineProperty(obj, "foo", { |
| 17 |
value: +0, |
| 18 |
writable: false, |
| 19 |
configurable: false |
| 20 |
}); |
| 21 |
|
| 22 |
try { |
| 23 |
Object.defineProperties(obj, { |
| 24 |
foo: { |
| 25 |
value: -0 |
| 26 |
} |
| 27 |
}); |
| 28 |
$ERROR("Expected an exception."); |
| 29 |
} catch (e) { |
| 30 |
verifyEqualTo(obj, "foo", +0); |
| 31 |
|
| 32 |
verifyNotWritable(obj, "foo"); |
| 33 |
|
| 34 |
verifyNotEnumerable(obj, "foo"); |
| 35 |
|
| 36 |
verifyNotConfigurable(obj, "foo"); |
| 37 |
|
| 38 |
if (!(e instanceof TypeError)) { |
| 39 |
$ERROR("Expected TypeError, got " + e); |
| 40 |
} |
| 41 |
|
| 42 |
} |