summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/for-in/order-property-on-prototype.js
blob: c1f1e9de38a20d61589216fc46a75c305a7ffa75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2019 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-enumerate-object-properties
description: Properties on the prototype are enumerated after properties on the object
features: [for-in-order]
includes: [compareArray.js]
---*/

var proto = {
  p4: 'p4',
};

var o = {
  p1: 'p1',
  p2: 'p2',
  p3: 'p3',
};

Object.setPrototypeOf(o, proto);

var keys = [];
for (var key in o) {
  keys.push(key);
}

assert.compareArray(keys, ['p1', 'p2', 'p3', 'p4']);

reportCompare(0, 0);