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

Unified Diff: pkg/unittest/lib/src/expect.dart

Issue 12217142: Unit test improvements: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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: pkg/unittest/lib/src/expect.dart
===================================================================
--- pkg/unittest/lib/src/expect.dart (revision 18358)
+++ pkg/unittest/lib/src/expect.dart (working copy)
@@ -122,8 +122,24 @@
add('\n but: ');
matcher.describeMismatch(actual, description, matchState, verbose);
description.add('.\n');
- if (verbose && actual is Iterable) {
- description.add('Actual: ').addDescriptionOf(actual).add('\n');
+ if (verbose) {
+ if (actual is Iterable) {
+ description.add('Actual: ').addDescriptionOf(actual).add('\n');
+ } else if (actual is Map) {
+ description.add('Actual: ');
+ var count = 25;
Siggi Cherem (dart-lang) 2013/02/12 21:06:15 seems quite arbitrary to use 25 =)... maybe 10? (e
gram 2013/02/12 21:08:09 As you say, it is arbitrary. 10 feels too small fo
+ for (var k in actual.keys) {
Siggi Cherem (dart-lang) 2013/02/12 21:06:15 Is this description used for any other purpose? Wi
gram 2013/02/12 21:08:09 No. Unlike the matcher description; this is the er
+ if (count == 0) {
+ description.add('...\n');
+ break;
+ }
+ description.addDescriptionOf(k);
+ description.add(' : ');
+ description.addDescriptionOf(actual[k]);
+ description.add('\n');
+ --count;
+ }
+ }
}
if (reason != null) {
description.add(reason).add('\n');

Powered by Google App Engine
This is Rietveld 408576698