Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Object / assign / Override.js
blobaf125dcca72026fcf080c2f6cc1f1e231fe7fce5
1 // Copyright 2015 Microsoft Corporation. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
4 /*---
5 description: Test Object.Assign(target,...sources).
6 esid: sec-object.assign
7 ---*/
9 //"a" will be an property of the final object and the value should be 1
10 var target = {
11   a: 1
14 "1a2c3" have own enumerable properties, so it Should be wrapped to objects;
15 {b:6} is an object,should be assigned to final object.
16 undefined and null should be ignored;
17 125 is a number,it cannot has own enumerable properties;
18 {a:"c"},{a:5} will override property a, the value should be 5.
20 var result = Object.assign(target, "1a2c3", {
21   a: "c"
22 }, undefined, {
23   b: 6
24 }, null, 125, {
25   a: 5
26 });
28 assert.sameValue(Object.getOwnPropertyNames(result).length, 7, "The length should be 7 in the final object.");
29 assert.sameValue(result.a, 5, "The value should be {a:5}.");
30 assert.sameValue(result[0], "1", "The value should be {\"0\":\"1\"}.");
31 assert.sameValue(result[1], "a", "The value should be {\"1\":\"a\"}.");
32 assert.sameValue(result[2], "2", "The value should be {\"2\":\"2\"}.");
33 assert.sameValue(result[3], "c", "The value should be {\"3\":\"c\"}.");
34 assert.sameValue(result[4], "3", "The value should be {\"4\":\"3\"}.");
35 assert.sameValue(result.b, 6, "The value should be {b:6}.");
37 reportCompare(0, 0);