Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-295-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-295-1
6 description: >
7 Object.defineProperty - 'O' is an Arguments object of a function
8 that has formal parameters, 'name' is own data property of 'O'
9 which is also defined in [[ParameterMap]] of 'O', test TypeError
10 is thrown when updating the [[Enumerable]] attribute value of
11 'name' which is defined as non-configurable (10.6
12 [[DefineOwnProperty]] step 4 and step 5b)
13 includes: [propertyHelper.js]
14 flags: [noStrict]
15 ---*/
16
17
18 (function(a, b, c) {
19 Object.defineProperty(arguments, "0", {
20 value: 10,
21 writable: false,
22 enumerable: true,
23 configurable: false
24 });
25 try {
26 Object.defineProperty(arguments, "0", {
27 enumerable: false
28 });
29 $ERROR("Expected an exception.");
30 } catch (e) {
31 if (!(e instanceof TypeError)) {
32 $ERROR("Expected TypeError, got " + e);
33 }
34
35 verifyEqualTo(arguments, "0", 10);
36
37 verifyNotWritable(arguments, "0");
38
39 verifyEnumerable(arguments, "0");
40
41 verifyNotConfigurable(arguments, "0");
42
43 if (a !== 10) {
44 $ERROR('Expected "a === 10", actually ' + a);
45 }
46 }
47 }(0, 1, 2));