Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: tests/corelib/list_iterators_test.dart

Issue 12040018: Make ListIterator throw if the underlying list's length changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/collection_dev/list.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/collection_dev/list.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698