| // Copyright (C) 2016 the V8 project authors. All rights reserved. |
| // This code is governed by the BSD license found in the LICENSE file. |
| /*--- |
| template: default |
| desc: Lone rest element |
| info: > |
| 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| |
| BindingRestElement : ... BindingIdentifier |
| |
| [...] |
| 3. Let A be ArrayCreate(0). |
| [...] |
| 5. Repeat |
| [...] |
| f. Let status be CreateDataProperty(A, ToString (n), nextValue). |
| [...] |
| ---*/ |
| |
| //- setup |
| var values = [1, 2, 3]; |
| //- elems |
| [...x] |
| //- vals |
| values |
| //- body |
| assert(Array.isArray(x)); |
| assert.sameValue(x.length, 3); |
| assert.sameValue(x[0], 1); |
| assert.sameValue(x[1], 2); |
| assert.sameValue(x[2], 3); |
| assert.notSameValue(x, values); |