Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js

raw
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-274
6 description: >
7 Object.defineProperties - 'O' is an Array, 'P' is generic own
8 accessor property of 'O', test TypeError is thrown when updating
9 the [[Get]] attribute value of 'P' which is defined as
10 non-configurable (15.4.5.1 step 5)
11 includes: [propertyHelper.js]
12 ---*/
13
14 var arr = [];
15
16 function get_fun() {
17 return 37;
18 }
19
20 function set_fun(value) {
21 arr.verifySetFun = value;
22 }
23 Object.defineProperty(arr, "property", {
24 get: get_fun,
25 set: set_fun
26 });
27
28 try {
29 Object.defineProperties(arr, {
30 "property": {
31 get: function() {
32 return 36;
33 }
34 }
35 });
36 $ERROR("Expected an exception.");
37 } catch (e) {
38 verifyEqualTo(arr, "property", get_fun());
39
40 verifyWritable(arr, "property", "verifySetFun");
41
42 verifyNotEnumerable(arr, "property");
43
44 verifyNotConfigurable(arr, "property");
45
46 if (!(e instanceof TypeError)) {
47 $ERROR("Expected TypeError, got " + e);
48 }
49
50 }