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

Side by Side 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 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 #library('unittestTest'); 5 #library('unittestTest');
6 #import('../../../lib/unittest/unittest.dart'); 6 #import('../../../lib/unittest/unittest.dart');
7 7
8 class MockList extends Mock implements List { 8 class MockList extends Mock implements List {
9 } 9 }
10 10
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 expect(result.logs, orderedEquals([e1, e2, e4, e5, e6, e8, e9])); 580 expect(result.logs, orderedEquals([e1, e2, e4, e5, e6, e8, e9]));
581 581
582 result = logList.preceding(keyList, distance:3, includeKeys:true); 582 result = logList.preceding(keyList, distance:3, includeKeys:true);
583 expect(result.logs, orderedEquals([e0, e1, e2, e3, e4, e5, e6, 583 expect(result.logs, orderedEquals([e0, e1, e2, e3, e4, e5, e6,
584 e7, e8, e9, e10])); 584 e7, e8, e9, e10]));
585 585
586 result = logList.following(keyList, distance:3, includeKeys:true); 586 result = logList.following(keyList, distance:3, includeKeys:true);
587 expect(result.logs, orderedEquals([e0, e1, e2, e3, e4, e5, e6, 587 expect(result.logs, orderedEquals([e0, e1, e2, e3, e4, e5, e6,
588 e7, e8, e9, e10])); 588 e7, e8, e9, e10]));
589 }); 589 });
590
591 test('Mocking: stepwiseValidate', () {
592 LogEntryList logList = new LogEntryList('test');
593 for (var i = 0; i < 10; i++) {
594 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
595 logList.add(e);
596 }
597 int total = 0;
598 logList.stepwiseValidate((l, pos) {
Siggi Cherem (dart-lang) 2012/08/07 23:58:47 ditto: l => logs
599 total += l[pos].args[0] * l[pos+1].args[0];
Siggi Cherem (dart-lang) 2012/08/07 23:58:47 style: space around operators (+)
600 expect(l[pos+1].args[0] - l[pos].args[0], equals(1));
601 return 2;
602 });
603 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
604 });
590 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698