Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | (function TestForOfName() { |
| 6 | var result = 0; |
| 7 | var index; |
| 8 | |
| 9 | for (index of [1, 2, 3, 4, 5]) result += index; |
| 10 | |
| 11 | assertEquals(result, 15); |
| 12 | assertEquals(index, 5); |
| 13 | })(); |
| 14 | |
| 15 | |
| 16 | (function TestForOfProperty() { |
| 17 | var O = {}; |
| 18 | var result = 0; |
| 19 | |
| 20 | for (O.index of [1, 2, 3, 4, 5]) result += O.index; |
| 21 | |
| 22 | assertEquals(result, 15); |
| 23 | assertEquals(O.index, 5); |
| 24 | })(); |