Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-281.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-281
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is generic own
8 data property of 'O', test TypeError is thrown when updating the
9 [[Value]] attribute value of 'name' which is defined as
10 non-writable and non-configurable (15.4.5.1 step 5)
11 includes: [propertyHelper.js]
12 ---*/
13
14
15 var arrObj = [];
16
17 Object.defineProperty(arrObj, "property", {
18 value: 12
19 });
20 try {
21 Object.defineProperty(arrObj, "property", {
22 value: 36
23 });
24 $ERROR("Expected an exception.");
25 } catch (e) {
26 verifyEqualTo(arrObj, "property", 12);
27
28 verifyNotWritable(arrObj, "property");
29
30 verifyNotEnumerable(arrObj, "property");
31
32 verifyNotConfigurable(arrObj, "property");
33
34 if (!(e instanceof TypeError)) {
35 $ERROR("Expected TypeError, got " + e);
36 }
37
38 }