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

Side by Side Diff: pkg/unittest/lib/mock.dart

Issue 11412086: Make 'where' lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: FilteredIterable/Iterator -> WhereIterable/Iterator. Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * A simple mocking/spy library. 6 * A simple mocking/spy library.
7 * 7 *
8 * To create a mock objects for some class T, create a new class using: 8 * To create a mock objects for some class T, create a new class using:
9 * 9 *
10 * class MockT extends Mock implements T {}; 10 * class MockT extends Mock implements T {};
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 1454
1455 /** Clear the behaviors for the Mock. */ 1455 /** Clear the behaviors for the Mock. */
1456 void resetBehavior() => _behaviors.clear(); 1456 void resetBehavior() => _behaviors.clear();
1457 1457
1458 /** Clear the logs for the Mock. */ 1458 /** Clear the logs for the Mock. */
1459 void clearLogs() { 1459 void clearLogs() {
1460 if (log != null) { 1460 if (log != null) {
1461 if (name == null) { // This log is not shared. 1461 if (name == null) { // This log is not shared.
1462 log.logs.clear(); 1462 log.logs.clear();
1463 } else { // This log may be shared. 1463 } else { // This log may be shared.
1464 log.logs = log.logs.where((e) => e.mockName != name); 1464 log.logs = log.logs.where((e) => e.mockName != name).toList();
1465 } 1465 }
1466 } 1466 }
1467 } 1467 }
1468 1468
1469 /** Clear both logs and behavior. */ 1469 /** Clear both logs and behavior. */
1470 void reset() { 1470 void reset() {
1471 resetBehavior(); 1471 resetBehavior();
1472 clearLogs(); 1472 clearLogs();
1473 } 1473 }
1474 } 1474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698