| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |