| 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 class ListIteratorsTest { | 5 class ListIteratorsTest { |
| 6 static void checkListIterator(List a) { | 6 static void checkListIterator(List a) { |
| 7 Iterator it = a.iterator; | 7 Iterator it = a.iterator; |
| 8 Expect.isNull(it.current); | 8 Expect.isNull(it.current); |
| 9 for (int i = 0; i < a.length; i++) { | 9 for (int i = 0; i < a.length; i++) { |
| 10 Expect.isTrue(it.moveNext()); | 10 Expect.isTrue(it.moveNext()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 Expect.isTrue(it.moveNext()); | 30 Expect.isTrue(it.moveNext()); |
| 31 Expect.equals(1, it.current); | 31 Expect.equals(1, it.current); |
| 32 Expect.isTrue(it.moveNext()); | 32 Expect.isTrue(it.moveNext()); |
| 33 g[1] = 49; | 33 g[1] = 49; |
| 34 // The iterator keeps the last value. | 34 // The iterator keeps the last value. |
| 35 Expect.equals(2, it.current); | 35 Expect.equals(2, it.current); |
| 36 Expect.isTrue(it.moveNext()); | 36 Expect.isTrue(it.moveNext()); |
| 37 g.removeLast(); | 37 g.removeLast(); |
| 38 // The iterator keeps the last value. | 38 // The iterator keeps the last value. |
| 39 Expect.equals(3, it.current); | 39 Expect.equals(3, it.current); |
| 40 Expect.throws(it.moveNext, (e) => e is ConcurrentModificationError); |
| 41 // No progress when throwing. |
| 42 Expect.equals(3, it.current); |
| 40 } | 43 } |
| 41 } | 44 } |
| 42 | 45 |
| 43 main() { | 46 main() { |
| 44 ListIteratorsTest.testMain(); | 47 ListIteratorsTest.testMain(); |
| 45 } | 48 } |
| OLD | NEW |