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-194.js
blobf1172f881068096209fc0ccf242a4cac95422b35
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-194
6 description: >
7     Object.defineProperty - 'O' is an Array, 'name' is an array index
8     named property, 'name' is own accessor property, test TypeError is
9     thrown on updating the configurable attribute from false to true
10     (15.4.5.1 step 4.c)
11 includes: [propertyHelper.js]
12 ---*/
14 var arrObj = [];
15 var getFunc = function() {
16   return 11;
19 Object.defineProperty(arrObj, "0", {
20   get: getFunc,
21   configurable: false
22 });
24 try {
25   Object.defineProperty(arrObj, "0", {
26     configurable: true
27   });
28   throw new Test262Error("Expected an exception.");
29 } catch (e) {
30   verifyEqualTo(arrObj, "0", getFunc());
32   if (!(e instanceof TypeError)) {
33     throw new Test262Error("Expected TypeError, got " + e.name);
34   }
37 verifyProperty(arrObj, "0", {
38   enumerable: false,
39   configurable: false,
40 });
42 reportCompare(0, 0);