Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-297.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-297
6 description: >
7 Object.defineProperty - 'O' is an Arguments object, 'name' is own
8 accessor property of 'O', test TypeError is thrown when updating
9 the [[Get]] attribute value of 'name' which is defined as
10 non-configurable (10.6 [[DefineOwnProperty]] step 4)
11 includes: [propertyHelper.js]
12 ---*/
13
14 (function() {
15 function getFunc1() {
16 return 10;
17 }
18 Object.defineProperty(arguments, "0", {
19 get: getFunc1,
20 enumerable: false,
21 configurable: false
22 });
23
24 function getFunc2() {
25 return 20;
26 }
27 try {
28 Object.defineProperty(arguments, "0", {
29 get: getFunc2
30 });
31 $ERROR("Expected an exception.");
32 } catch (e) {
33 verifyEqualTo(arguments, "0", getFunc1());
34
35 verifyNotEnumerable(arguments, "0");
36
37 verifyNotConfigurable(arguments, "0");
38
39 if (!(e instanceof TypeError)) {
40 $ERROR("Expected TypeError, got " + e);
41 }
42
43 }
44 }(0, 1, 2));