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

Unified Diff: tests/lib/unittest/mock_test.dart

Issue 10855128: Added ability to reset Mocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« lib/unittest/mock.dart ('K') | « lib/unittest/mock.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/unittest/mock_test.dart
===================================================================
--- tests/lib/unittest/mock_test.dart (revision 10584)
+++ tests/lib/unittest/mock_test.dart (working copy)
@@ -602,4 +602,30 @@
});
expect(total, equals((0 * 1) + (2 * 3) + (4 * 5) + (6 * 7) + (8 * 9)));
});
+
+ test('Mocking: clearLogs', () {
+ var m = new Mock();
+ m.foo();
+ m.foo();
+ m.foo();
+ expect(m.log.logs, hasLength(3));
+ m.clearLogs();
+ expect(m.log.logs, hasLength(0));
+ LogEntryList log = new LogEntryList();
+ var m1 = new Mock.custom(name: 'm1', log: log);
+ var m2 = new Mock.custom(name: 'm2', log: log);
+ var m3 = new Mock.custom(name: 'm3', log: log);
+ for (var i = 0; i < 3; i++) {
+ m1.foo();
+ m2.bar();
+ m3.pow();
+ }
+ expect(log.logs, hasLength(9));
+ m1.clearLogs();
+ expect(log.logs, hasLength(6));
Siggi Cherem (dart-lang) 2012/08/13 17:09:12 I'd check also that: log.logs.every((e) => e.mockN
+ m2.clearLogs();
Siggi Cherem (dart-lang) 2012/08/13 17:09:12 I'd also check that calling m1.clearLogs() again i
+ expect(log.logs, hasLength(3));
+ m3.clearLogs();
+ expect(log.logs, hasLength(0));
+ });
}
« lib/unittest/mock.dart ('K') | « lib/unittest/mock.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698