Index: pkg/unittest/lib/src/description.dart |
diff --git a/pkg/unittest/lib/src/description.dart b/pkg/unittest/lib/src/description.dart |
index cdd819348914e70c4434350c48a5c296385d1951..cde5243ef175f7731ee5c025243182e4d6a07262 100644 |
--- a/pkg/unittest/lib/src/description.dart |
+++ b/pkg/unittest/lib/src/description.dart |
@@ -41,23 +41,8 @@ class StringDescription implements Description { |
Description addDescriptionOf(value) { |
if (value is Matcher) { |
value.describe(this); |
- } else if (value is String) { |
- _addEscapedString(value); |
} else { |
- String description = (value == null) ? "null" : value.toString(); |
- if (description.startsWith('<') && description.endsWith('>')) { |
- add(description); |
- } else if (description.startsWith("Instance of")) { |
- add('<'); |
- add(description); |
- add(':'); |
- add(value.hashCode.toString()); |
- add('>'); |
- } else { |
- add('<'); |
- add(description); |
- add('>'); |
- } |
+ add(prettyPrint(value, maxLineLength: 80, maxItems: 25)); |
} |
return this; |
} |
@@ -85,23 +70,7 @@ class StringDescription implements Description { |
/** Escape the control characters in [string] so that they are visible. */ |
_addEscapedString(String string) { |
add("'"); |
- for (var i = 0; i < string.length; i++) { |
- add(_escape(string[i])); |
- } |
+ add(escapeString(string)); |
add("'"); |
} |
- |
- /** Return the escaped form of a character [ch]. */ |
- _escape(ch) { |
- if (ch == "'") |
- return "\'"; |
- else if (ch == '\n') |
- return '\\n'; |
- else if (ch == '\r') |
- return '\\r'; |
- else if (ch == '\t') |
- return '\\t'; |
- else |
- return ch; |
- } |
} |