Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/keys/15.2.3.14-2-8.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.14-2-8
6 description: >
7 Object.keys - 'n' is the correct value when enumerable properties
8 exist in 'O'
9 ---*/
10
11 var obj = {
12 prop1: 1001,
13 prop2: function() {
14 return 1002;
15 }
16 };
17
18 Object.defineProperty(obj, "prop3", {
19 value: 1003,
20 enumerable: false,
21 configurable: true
22 });
23
24 Object.defineProperty(obj, "prop4", {
25 get: function() {
26 return 1004;
27 },
28 enumerable: false,
29 configurable: true
30 });
31
32 var arr = Object.keys(obj);
33
34 assert.sameValue(arr.length, 2, 'arr.length');
35 assert.sameValue(arr[0], "prop1", 'arr[0]');
36 assert.sameValue(arr[1], "prop2", 'arr[1]');