Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Object / assign / strings-and-symbol-order.js
blob57cf13c377db1ab3d901a1ce7795ebb4b73afad0
1 // Copyright (C) 2018 AndrĂ© Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-object.assign
6 description: >
7   Symbol-valued properties are copied after String-valued properties.
8 info: |
9   19.1.2.1 Object.assign ( target, ...sources )
11   ...
12   4. For each element nextSource of sources, in ascending index order, do
13     a. ...
14     b. Else,
15       i. Let from be ! ToObject(nextSource).
16       ii. Let keys be ? from.[[OwnPropertyKeys]]().
17     c. For each element nextKey of keys in List order, do
18     ...
19   ...
21   9.1.11.1 OrdinaryOwnPropertyKeys ( O )
23   ...
24   3. For each own property key P of O that is a String but is not an integer index,
25      in ascending chronological order of property creation, do
26     a. Add P as the last element of keys.
27   4. For each own property key P of O that is a Symbol, in ascending chronological
28      order of property creation, do
29     a. Add P as the last element of keys.
30   ...
32 includes: [compareArray.js]
33 ---*/
35 var log = [];
37 var sym1 = Symbol("x");
38 var sym2 = Symbol("y");
40 var source = {};
42 Object.defineProperty(source, sym1, {
43     get: function(){ log.push("get sym(x)") },
44     enumerable: true, configurable: true,
45 });
46 Object.defineProperty(source, "a", {
47     get: function(){ log.push("get a") },
48     enumerable: true, configurable: true,
49 });
50 Object.defineProperty(source, sym2, {
51     get: function(){ log.push("get sym(y)") },
52     enumerable: true, configurable: true,
53 });
54 Object.defineProperty(source, "b", {
55     get: function(){ log.push("get b") },
56     enumerable: true, configurable: true,
57 });
59 var target = Object.assign({}, source);
61 assert.compareArray(log, ["get a", "get b", "get sym(x)", "get sym(y)"]);
63 reportCompare(0, 0);