Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Object / defineProperty / 15.2.3.6-4-246.js
blob863f1a7c715b5ac1eb878d943304223c177347ec
1 // Copyright (c) 2012 Ecma International.  All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 es5id: 15.2.3.6-4-246
6 description: >
7     Object.defineProperty - 'O' is an Array, 'name' is an array index
8     named property, 'name' is data property and 'desc' is data
9     descriptor, and the [[Configurable]] attribute value of 'name' is
10     false, test TypeError is thrown if the [[Writable]] attribute
11     value of 'name' is false, and the [[Value]] field of 'desc' is +0,
12     and the [[Value]] attribute value of 'name' is -0 (15.4.5.1 step
13     4.c)
14 includes: [propertyHelper.js]
15 ---*/
17 var arrObj = [];
19 Object.defineProperty(arrObj, "1", {
20   value: -0
21 });
23 try {
24   Object.defineProperty(arrObj, "1", {
25     value: +0
26   });
27   throw new Test262Error("Expected an exception.");
28 } catch (e) {
29   if (!(e instanceof TypeError)) {
30     throw new Test262Error("Expected TypeError, got " + e);
31   }
34 verifyProperty(arrObj, "1", {
35   value: -0,
36   writable: false,
37   enumerable: false,
38   configurable: false,
39 });
41 reportCompare(0, 0);