| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Test foreach (aka. for-in) functionality. | 5 // Test foreach (aka. for-in) functionality. |
| 6 | 6 |
| 7 testIterator(List expect, Iterable input) { | 7 testIterator(List expect, Iterable input) { |
| 8 int i = 0; | 8 int i = 0; |
| 9 for (var value in input) { | 9 for (var value in input) { |
| 10 Expect.isTrue(i < expect.length); | 10 Expect.isTrue(i < expect.length); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Using the same variable (showing that the expression is evaluated | 72 // Using the same variable (showing that the expression is evaluated |
| 73 // in the outer scope). | 73 // in the outer scope). |
| 74 int result = 0; | 74 int result = 0; |
| 75 var x = [1,2,3]; | 75 var x = [1,2,3]; |
| 76 for (var x in x) { | 76 for (var x in x) { |
| 77 result += x; | 77 result += x; |
| 78 } | 78 } |
| 79 Expect.equals(6, result); | 79 Expect.equals(6, result); |
| 80 } | 80 } |
| OLD | NEW |