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

Unified Diff: tests/corelib/list_test.dart

Issue 1064053007: Revert "Change ListIterator to only check for concurrent modification at each iteration" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/json_map_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/list_test.dart
diff --git a/tests/corelib/list_test.dart b/tests/corelib/list_test.dart
index bb7398ac90c8d97bf45df199fcd82476254dfdb4..5187ee84ccce4cb210548b52923e1db406914798 100644
--- a/tests/corelib/list_test.dart
+++ b/tests/corelib/list_test.dart
@@ -376,34 +376,23 @@ void testGrowableListOperations(List list) {
list.replaceRange(6, 8, []);
Expect.listEquals([1, 2, 6, 6, 5, 0, 2, 3, 2, 1], list);
- // Operations that change the length may cause ConcurrentModificationError.
- // Reducing the length may cause a RangeError before the
- // ConcurrentModificationError in production mode.
- bool checkedMode = false;
- assert((checkedMode = true));
-
+ // Operations that change the length cause ConcurrentModificationError.
void testConcurrentModification(action()) {
testIterator(int when) {
list.length = 4;
list.setAll(0, [0, 1, 2, 3]);
Expect.throws(() {
for (var element in list) {
- if (element == when) {
- when = -1; // Prevent triggering more than once.
- action();
- }
+ if (element == when) action();
}
- }, (e) => !checkedMode || e is ConcurrentModificationError);
+ }, (e) => e is ConcurrentModificationError);
}
testForEach(int when) {
list.length = 4;
list.setAll(0, [0, 1, 2, 3]);
Expect.throws(() {
list.forEach((var element) {
- if (element == when) {
- when = -1;
- action();
- }
+ if (element == when) action();
});
}, (e) => e is ConcurrentModificationError);
}
« no previous file with comments | « tests/corelib/json_map_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698