Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Object / defineProperties / 15.2.3.7-6-a-240.js
blobce8c4c36a68caf577aaae2acf99527285bdb9d7e
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.7-6-a-240
6 description: >
7     Object.defineProperties - TypeError is thrown if 'O' is an Array,
8     'P' is an array index named property that already exists on 'O' is
9     data property with  [[Configurable]], [[Writable]] false, 'desc'
10     is data descriptor, [[Value]] field of 'desc' and the [[Value]]
11     attribute value of 'P' are two objects which refer to the
12     different objects (15.4.5.1 step 4.c)
13 includes: [propertyHelper.js]
14 ---*/
16 var arr = [];
17 var obj1 = {
18   value: 12
20 var obj2 = {
21   value: 36
24 Object.defineProperty(arr, "1", {
25   value: obj1
26 });
28 try {
29   Object.defineProperties(arr, {
30     "1": {
31       value: obj2
32     }
33   });
35   throw new Test262Error("Expected an exception.");
36 } catch (e) {
37   if (!(e instanceof TypeError)) {
38     throw new Test262Error("Expected TypeError, got " + e);
39   }
42 verifyProperty(arr, "1", {
43   value: obj1,
44   writable: false,
45   enumerable: false,
46   configurable: false,
47 });
49 reportCompare(0, 0);