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

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

Issue 1024843002: 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: Changelog. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/corelib/iterable_reduce_test.dart ('k') | tests/corelib/list_test.dart » ('j') | 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 library json_map_test; 5 library json_map_test;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:convert' show JSON; 8 import 'dart:convert' show JSON;
9 import 'dart:collection' show LinkedHashMap, HashMap; 9 import 'dart:collection' show LinkedHashMap, HashMap;
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void testToString() { 156 void testToString() {
157 Expect.equals("{}", jsonify({}).toString()); 157 Expect.equals("{}", jsonify({}).toString());
158 Expect.equals("{a: 0}", jsonify({'a': 0}).toString()); 158 Expect.equals("{a: 0}", jsonify({'a': 0}).toString());
159 } 159 }
160 160
161 void testConcurrentModifications() { 161 void testConcurrentModifications() {
162 void testIterate(Map map, Iterable iterable, Function f) { 162 void testIterate(Map map, Iterable iterable, Function f) {
163 Iterator iterator = iterable.iterator; 163 Iterator iterator = iterable.iterator;
164 f(map); 164 f(map);
165 iterator.moveNext(); 165 while (iterator.moveNext());
166 } 166 }
167 167
168 void testKeys(Map map, Function f) => testIterate(map, map.keys, f); 168 void testKeys(Map map, Function f) => testIterate(map, map.keys, f);
169 void testValues(Map map, Function f) => testIterate(map, map.values, f); 169 void testValues(Map map, Function f) => testIterate(map, map.values, f);
170 170
171 void testForEach(Map map, Function f) { 171 void testForEach(Map map, Function f) {
172 map.forEach((key, value) { 172 map.forEach((key, value) {
173 f(map); 173 f(map);
174 }); 174 });
175 } 175 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 337 }
338 338
339 void testMutation() { 339 void testMutation() {
340 Map map = jsonify({'a': 0}); 340 Map map = jsonify({'a': 0});
341 Expect.listEquals(['a', 0], listEach(map)); 341 Expect.listEquals(['a', 0], listEach(map));
342 map['a'] = 1; 342 map['a'] = 1;
343 Expect.listEquals(['a', 1], listEach(map)); 343 Expect.listEquals(['a', 1], listEach(map));
344 map['a']++; 344 map['a']++;
345 Expect.listEquals(['a', 2], listEach(map)); 345 Expect.listEquals(['a', 2], listEach(map));
346 } 346 }
OLDNEW
« no previous file with comments | « tests/corelib/iterable_reduce_test.dart ('k') | tests/corelib/list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698