| 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);
|
| }
|
|
|