| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 } | 664 } |
| 665 } | 665 } |
| 666 | 666 |
| 667 /** | 667 /** |
| 668 * Returns log events that happened after [when]. If [inPlace] | 668 * Returns log events that happened after [when]. If [inPlace] |
| 669 * is true, then it returns this LogEntryList after removing | 669 * is true, then it returns this LogEntryList after removing |
| 670 * the entries that happened up to [when]; otherwise a new | 670 * the entries that happened up to [when]; otherwise a new |
| 671 * list is created. | 671 * list is created. |
| 672 */ | 672 */ |
| 673 LogEntryList after(DateTime when, [bool inPlace = false]) => | 673 LogEntryList after(DateTime when, [bool inPlace = false]) => |
| 674 _tail((e) => e.time > when, inPlace, 'after $when', logs.length); | 674 _tail((e) => e.time.isAfter(when), inPlace, 'after $when', logs.length); |
| 675 | 675 |
| 676 /** | 676 /** |
| 677 * Returns log events that happened from [when] onwards. If | 677 * Returns log events that happened from [when] onwards. If |
| 678 * [inPlace] is true, then it returns this LogEntryList after | 678 * [inPlace] is true, then it returns this LogEntryList after |
| 679 * removing the entries that happened before [when]; otherwise | 679 * removing the entries that happened before [when]; otherwise |
| 680 * a new list is created. | 680 * a new list is created. |
| 681 */ | 681 */ |
| 682 LogEntryList from(DateTime when, [bool inPlace = false]) => | 682 LogEntryList from(DateTime when, [bool inPlace = false]) => |
| 683 _tail((e) => e.time >= when, inPlace, 'from $when', logs.length); | 683 _tail((e) => !e.time.isBefore(when), inPlace, 'from $when', logs.length); |
| 684 | 684 |
| 685 /** | 685 /** |
| 686 * Returns log events that happened until [when]. If [inPlace] | 686 * Returns log events that happened until [when]. If [inPlace] |
| 687 * is true, then it returns this LogEntryList after removing | 687 * is true, then it returns this LogEntryList after removing |
| 688 * the entries that happened after [when]; otherwise a new | 688 * the entries that happened after [when]; otherwise a new |
| 689 * list is created. | 689 * list is created. |
| 690 */ | 690 */ |
| 691 LogEntryList until(DateTime when, [bool inPlace = false]) => | 691 LogEntryList until(DateTime when, [bool inPlace = false]) => |
| 692 _head((e) => e.time > when, inPlace, 'until $when', logs.length); | 692 _head((e) => e.time.isAfter(when), inPlace, 'until $when', logs.length); |
| 693 | 693 |
| 694 /** | 694 /** |
| 695 * Returns log events that happened before [when]. If [inPlace] | 695 * Returns log events that happened before [when]. If [inPlace] |
| 696 * is true, then it returns this LogEntryList after removing | 696 * is true, then it returns this LogEntryList after removing |
| 697 * the entries that happened from [when] onwards; otherwise a new | 697 * the entries that happened from [when] onwards; otherwise a new |
| 698 * list is created. | 698 * list is created. |
| 699 */ | 699 */ |
| 700 LogEntryList before(DateTime when, [bool inPlace = false]) => | 700 LogEntryList before(DateTime when, [bool inPlace = false]) => |
| 701 _head((e) => e.time >= when, inPlace, 'before $when', logs.length); | 701 _head((e) => !e.time.isBefore(when), |
| 702 inPlace, |
| 703 'before $when', |
| 704 logs.length); |
| 702 | 705 |
| 703 /** | 706 /** |
| 704 * Returns log events that happened after [logEntry]'s time. | 707 * Returns log events that happened after [logEntry]'s time. |
| 705 * If [inPlace] is true, then it returns this LogEntryList after | 708 * If [inPlace] is true, then it returns this LogEntryList after |
| 706 * removing the entries that happened up to [when]; otherwise a new | 709 * removing the entries that happened up to [when]; otherwise a new |
| 707 * list is created. If [logEntry] is null the current time is used. | 710 * list is created. If [logEntry] is null the current time is used. |
| 708 */ | 711 */ |
| 709 LogEntryList afterEntry(LogEntry logEntry, [bool inPlace = false]) => | 712 LogEntryList afterEntry(LogEntry logEntry, [bool inPlace = false]) => |
| 710 after(logEntry == null ? new DateTime.now() : logEntry.time); | 713 after(logEntry == null ? new DateTime.now() : logEntry.time); |
| 711 | 714 |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 } | 1478 } |
| 1476 } | 1479 } |
| 1477 } | 1480 } |
| 1478 | 1481 |
| 1479 /** Clear both logs and behavior. */ | 1482 /** Clear both logs and behavior. */ |
| 1480 void reset() { | 1483 void reset() { |
| 1481 resetBehavior(); | 1484 resetBehavior(); |
| 1482 clearLogs(); | 1485 clearLogs(); |
| 1483 } | 1486 } |
| 1484 } | 1487 } |
| OLD | NEW |