Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/15.2.3.6-4-243-2-strict.js

raw
1 'use strict';
2 // Copyright (c) 2012 Ecma International. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 es5id: 15.2.3.6-4-243-2
7 description: >
8 Object.defineProperty - 'O' is an Array, 'name' is an array index
9 named property, 'name' is accessor property and assignment to
10 the accessor property, fails to convert accessor property from
11 accessor property to data property (15.4.5.1 step 4.c)
12 includes: [propertyHelper.js]
13 flags: [onlyStrict]
14 ---*/
15
16
17 var arrObj = [];
18
19 function getFunc() {
20 return 3;
21 }
22 Object.defineProperty(arrObj, "1", {
23 get: getFunc,
24 configurable: true
25 });
26
27 assert.throws(TypeError, function() {
28 arrObj[1] = 4;
29 });
30 verifyEqualTo(arrObj, "1", getFunc());
31
32 verifyProperty(arrObj, "1", {
33 enumerable: false,
34 configurable: true,
35 });
36
37 reportCompare(0, 0);