Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/assign/source-non-enum.js

raw
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 ---*/
14
15 var target = {};
16 var source = Object.defineProperty({}, 'attr', {
17 value: 1,
18 enumerable: false
19 });
20 var result;
21
22 result = Object.assign(target, source);
23
24 assert.sameValue(Object.hasOwnProperty.call(target, 'attr'), false);
25 assert.sameValue(result, target);