Debian Codegraph @

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