Debian Codegraph @

js/src/tests/test262/language/expressions/array/spread-obj-skip-non-enumerable.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/spread/obj-skip-non-enumerable.case
3 // - src/spread/default/array.template
4 /*---
5 description: Object Spread doesn't copy non-enumerable properties (Array initializer)
6 esid: sec-runtime-semantics-arrayaccumulation
7 features: [object-spread]
8 flags: [generated]
9 info: |
10 SpreadElement : ...AssignmentExpression
11
12 1. Let spreadRef be the result of evaluating AssignmentExpression.
13 2. Let spreadObj be ? GetValue(spreadRef).
14 3. Let iterator be ? GetIterator(spreadObj).
15 4. Repeat
16 a. Let next be ? IteratorStep(iterator).
17 b. If next is false, return nextIndex.
18 c. Let nextValue be ? IteratorValue(next).
19 d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
20 nextValue).
21 e. Assert: status is true.
22 f. Let nextIndex be nextIndex + 1.
23 ---*/
24
25 let o = {};
26 Object.defineProperty(o, "b", {value: 3, enumerable: false});
27
28
29 var callCount = 0;
30
31 (function(obj) {
32 assert.sameValue(obj.hasOwnProperty("b"), false)
33 assert.sameValue(Object.keys(obj).length, 0);
34 callCount += 1;
35 }.apply(null, [{...o}]));
36
37 assert.sameValue(callCount, 1);
38
39 reportCompare(0, 0);