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 library matcher.description; | 5 library matcher.description; |
6 | 6 |
7 import 'interfaces.dart'; | 7 import 'interfaces.dart'; |
8 import 'pretty_print.dart'; | 8 import 'pretty_print.dart'; |
9 | 9 |
10 /// The default implementation of [Description]. This should rarely need | 10 /// The default implementation of [Description]. This should rarely need |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 value.describe(this); | 44 value.describe(this); |
45 } else { | 45 } else { |
46 add(prettyPrint(value, maxLineLength: 80, maxItems: 25)); | 46 add(prettyPrint(value, maxLineLength: 80, maxItems: 25)); |
47 } | 47 } |
48 return this; | 48 return this; |
49 } | 49 } |
50 | 50 |
51 /// Append an [Iterable] [list] of objects to the description, using the | 51 /// Append an [Iterable] [list] of objects to the description, using the |
52 /// specified [separator] and framing the list with [start] | 52 /// specified [separator] and framing the list with [start] |
53 /// and [end]. | 53 /// and [end]. |
54 Description addAll(String start, String separator, String end, | 54 Description addAll( |
55 Iterable list) { | 55 String start, String separator, String end, Iterable list) { |
56 var separate = false; | 56 var separate = false; |
57 add(start); | 57 add(start); |
58 for (var item in list) { | 58 for (var item in list) { |
59 if (separate) { | 59 if (separate) { |
60 add(separator); | 60 add(separator); |
61 } | 61 } |
62 addDescriptionOf(item); | 62 addDescriptionOf(item); |
63 separate = true; | 63 separate = true; |
64 } | 64 } |
65 add(end); | 65 add(end); |
66 return this; | 66 return this; |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |