Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Object / assign / source-non-enum.js
blobe13857c627a2e30f6699839fb5f3b2b8804cf3ef
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 19.1.2.1
5 description: Does not assign non-enumerable source properties
6 info: |
7     [...]
8     5. For each element nextSource of sources, in ascending index order,
9        c. Repeat for each element nextKey of keys in List order,
10           i. Let desc be from.[[GetOwnProperty]](nextKey).
11           ii. ReturnIfAbrupt(desc).
12           iii. if desc is not undefined and desc.[[Enumerable]] is true, then
13 ---*/
15 var target = {};
16 var source = Object.defineProperty({}, 'attr', {
17   value: 1,
18   enumerable: false
19 });
20 var result;
22 result = Object.assign(target, source);
24 assert(
25   !Object.prototype.hasOwnProperty.call(target, 'attr'),
26   "Non-enumerable property 'attr' does not get copied to target"
28 assert.sameValue(result, target);
30 reportCompare(0, 0);