OLD | NEW |
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 part of matcher; | 5 part of matcher; |
6 | 6 |
7 /** | 7 /** |
8 * The default implementation of IDescription. This should rarely need | 8 * The default implementation of IDescription. This should rarely need |
9 * substitution, although conceivably it is a place where other languages | 9 * substitution, although conceivably it is a place where other languages |
10 * could be supported. | 10 * could be supported. |
(...skipping 29 matching lines...) Expand all Loading... |
40 */ | 40 */ |
41 Description addDescriptionOf(value) { | 41 Description addDescriptionOf(value) { |
42 if (value is Matcher) { | 42 if (value is Matcher) { |
43 value.describe(this); | 43 value.describe(this); |
44 } else if (value is String) { | 44 } else if (value is String) { |
45 _addEscapedString(value); | 45 _addEscapedString(value); |
46 } else { | 46 } else { |
47 String description = (value == null) ? "null" : value.toString(); | 47 String description = (value == null) ? "null" : value.toString(); |
48 if (description.startsWith('<') && description.endsWith('>')) { | 48 if (description.startsWith('<') && description.endsWith('>')) { |
49 add(description); | 49 add(description); |
| 50 } else if (description.startsWith("Instance of")) { |
| 51 add('<'); |
| 52 add(description); |
| 53 add(':'); |
| 54 add(value.hashCode.toString()); |
| 55 add('>'); |
50 } else { | 56 } else { |
51 add('<'); | 57 add('<'); |
52 add(description); | 58 add(description); |
53 add('>'); | 59 add('>'); |
54 } | 60 } |
55 } | 61 } |
56 return this; | 62 return this; |
57 } | 63 } |
58 | 64 |
59 /** | 65 /** |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 else if (ch == '\n') | 98 else if (ch == '\n') |
93 return '\\n'; | 99 return '\\n'; |
94 else if (ch == '\r') | 100 else if (ch == '\r') |
95 return '\\r'; | 101 return '\\r'; |
96 else if (ch == '\t') | 102 else if (ch == '\t') |
97 return '\\t'; | 103 return '\\t'; |
98 else | 104 else |
99 return ch; | 105 return ch; |
100 } | 106 } |
101 } | 107 } |
OLD | NEW |