summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/for-in/order-property-added.js
blob: 54ab4b19f5468e39c2080b727d738be0551c9edf (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
// 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 added to the object during iteration are not enumerated
features: [for-in-order]
includes: [compareArray.js]
---*/

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

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

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

reportCompare(0, 0);