Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-321-1.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.6-4-321-1
6 description: >
7 Object.defineProperty - 'O' is an Arguments object of a function
8 that has formal parameters, 'P' is own accessor property of 'O',
9 test TypeError is thrown when updating the [[Get]] attribute value
10 of 'P' which is not configurable (10.6 [[DefineOwnProperty]] step
11 4)
12 includes: [propertyHelper.js]
13 ---*/
14
15 (function(a, b, c) {
16 function getFunc() {
17 return "genericPropertyString";
18 }
19
20 function setFunc(value) {
21 this.helpVerifyGet = value;
22 }
23 Object.defineProperty(arguments, "genericProperty", {
24 get: getFunc,
25 set: setFunc,
26 configurable: false
27 });
28 try {
29 Object.defineProperty(arguments, "genericProperty", {
30 get: function() {
31 return "overideGenericPropertyString";
32 }
33 });
34 $ERROR("Expected an exception.");
35 } catch (e) {
36 if (a !== 1) {
37 $ERROR('Expected a === 1, actually ' + a);
38 }
39
40 verifyEqualTo(arguments, "genericProperty", getFunc());
41
42 verifyWritable(arguments, "genericProperty", "helpVerifyGet");
43
44 verifyNotEnumerable(arguments, "genericProperty");
45
46 verifyNotConfigurable(arguments, "genericProperty");
47
48 if (!(e instanceof TypeError)) {
49 $ERROR("Expected TypeError, got " + e);
50 }
51
52 }
53 }(1, 2, 3));