Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-299.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-299
6 description: >
7 Object.defineProperties - 'O' is an Arguments object, 'P' is an
8 array index named accessor property of 'O' but not defined in
9 [[ParameterMap]] of 'O', test TypeError is thrown when updating
10 the [[Set]] attribute value of 'P' which is not configurable (10.6
11 [[DefineOwnProperty]] step 4)
12 includes: [propertyHelper.js]
13 ---*/
14
15
16 var arg;
17
18 (function fun() {
19 arg = arguments;
20 }());
21
22 function get_func() {
23 return 0;
24 }
25
26 Object.defineProperty(arg, "0", {
27 get: get_func,
28 set: undefined,
29 enumerable: false,
30 configurable: false
31 });
32
33 function set_func(value) {
34 arg.setVerifyHelpProp = value;
35 }
36 try {
37 Object.defineProperties(arg, {
38 "0": {
39 set: set_func
40 }
41 });
42 $ERROR("Expected an exception.");
43 } catch (e) {
44 verifyEqualTo(arg, "0", get_func());
45
46 verifyNotEnumerable(arg, "0");
47
48 verifyNotConfigurable(arg, "0");
49
50 if (!(e instanceof TypeError)) {
51 $ERROR("Expected TypeError, got " + e);
52 }
53
54 }