Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-460.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-460
6 description: >
7 ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a
8 Function, [[Enumerable]] is true, [[Configurable]] is true) is
9 enumerable
10 ---*/
11
12 var propertyFound = false;
13
14 var obj = {};
15
16 var verifySetFunc = "data";
17 var setFunc = function(value) {
18 verifySetFunc = value;
19 };
20
21 Object.defineProperty(obj, "prop", {
22 get: undefined,
23 set: setFunc,
24 enumerable: true,
25 configurable: true
26 });
27
28 var propertyDefineCorrect = obj.hasOwnProperty("prop");
29 var desc = Object.getOwnPropertyDescriptor(obj, "prop");
30
31 for (var p in obj) {
32 if (p === "prop") {
33 propertyFound = true;
34 break;
35 }
36 }
37
38 assert(propertyFound, 'Property not found');
39 assert(propertyDefineCorrect, 'propertyDefineCorrect !== true');
40 assert.sameValue(desc.enumerable, true, 'desc.enumerable');