blob: ff10479e89ef5bf8acd48135021a560120c908fb [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// 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/*---
4es6id: 13.6.4
5description: Int8Array mutation during traversal using for..of
6info: >
7 Int8Array instances should be able to be traversed using a `for..of` loop,
8 and dynamic changes to their contents should be reflected in the iterated
9 values.
10features: [TypedArray]
11---*/
12
13var iterationCount = 0;
14var array = new Int8Array([3, 2, 4, 1]);
15
16var first = 3;
17var second = 64;
18var third = 4;
19var fourth = 1;
20
21for (var x of array) {
22 assert.sameValue(x, first);
23
24 first = second;
25 second = third;
26 third = fourth;
27 fourth = null;
28
29 array[1] = 64;
30
31 iterationCount += 1;
32}
33
34assert.sameValue(iterationCount, 4);