Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-439.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-439
6 description: >
7 ES5 Attributes - fail to update the accessor property ([[Get]] is
8 undefined, [[Set]] is undefined, [[Enumerable]] is true,
9 [[Configurable]] is false) to a data property
10 ---*/
11
12 var obj = {};
13
14 Object.defineProperty(obj, "prop", {
15 get: undefined,
16 set: undefined,
17 enumerable: true,
18 configurable: false
19 });
20 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
21 assert.throws(TypeError, function() {
22 Object.defineProperty(obj, "prop", {
23 value: 1001
24 });
25 });
26 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
27
28 assert(desc1.hasOwnProperty("get"), 'desc1.hasOwnProperty("get") !== true');
29 assert.sameValue(desc2.hasOwnProperty("value"), false, 'desc2.hasOwnProperty("value")');