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

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

Issue 10827201: Added the ability to tun off logging for individual behaviors. (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
Index: tests/lib/unittest/mock_test.dart
===================================================================
--- tests/lib/unittest/mock_test.dart (revision 10299)
+++ tests/lib/unittest/mock_test.dart (working copy)
@@ -587,4 +587,19 @@
expect(result.logs, orderedEquals([e0, e1, e2, e3, e4, e5, e6,
e7, e8, e9, e10]));
});
+
+ test('Mocking: stepwiseValidate', () {
+ LogEntryList logList = new LogEntryList('test');
+ for (var i = 0; i < 10; i++) {
+ LogEntry e = new LogEntry(null, 'foo', [ i ], Action.IGNORE);
Siggi Cherem (dart-lang) 2012/08/07 23:58:47 nit: no spaces around i (simply [i]), same in the
+ logList.add(e);
+ }
+ int total = 0;
+ logList.stepwiseValidate((l, pos) {
Siggi Cherem (dart-lang) 2012/08/07 23:58:47 ditto: l => logs
+ total += l[pos].args[0] * l[pos+1].args[0];
Siggi Cherem (dart-lang) 2012/08/07 23:58:47 style: space around operators (+)
+ expect(l[pos+1].args[0] - l[pos].args[0], equals(1));
+ return 2;
+ });
+ expect(total, equals(0*1+2*3+4*5+6*7+8*9));
Siggi Cherem (dart-lang) 2012/08/07 23:58:47 ditto: spaces - add parenthesis too, I know it is
+ });
}

Powered by Google App Engine
This is Rietveld 408576698