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

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

Issue 184103002: Support nested matchers in deep equality matching. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/pretty_print.dart
diff --git a/pkg/unittest/lib/src/pretty_print.dart b/pkg/unittest/lib/src/pretty_print.dart
index 14a0bb1f44c1f03d9847ddc88fcb2caa7fb6da82..a748ec356a7028b0e24288285ea75d4079a66eb7 100644
--- a/pkg/unittest/lib/src/pretty_print.dart
+++ b/pkg/unittest/lib/src/pretty_print.dart
@@ -4,6 +4,7 @@
library unittest.pretty_print;
+import '../matcher.dart';
Siggi Cherem (dart-lang) 2014/02/28 02:41:04 use package: ?
Bob Nystrom 2014/02/28 17:31:24 Do you think that's better? It seems a bit weird t
Siggi Cherem (dart-lang) 2014/02/28 17:37:19 Not really. I think in general is a bad idea to u
import 'utils.dart';
/**
@@ -19,6 +20,13 @@ import 'utils.dart';
*/
String prettyPrint(object, {int maxLineLength, int maxItems}) {
String _prettyPrint(object, int indent, Set seen, bool top) {
+ // If the object is a matcher, use its description.
+ if (object is Matcher) {
+ var description = new StringDescription();
+ object.describe(description);
+ return "<$description>";
+ }
+
// Avoid looping infinitely on recursively-nested data structures.
if (seen.contains(object)) return "(recursive)";
seen = seen.union(new Set.from([object]));

Powered by Google App Engine
This is Rietveld 408576698