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

Side by Side Diff: pkg/unittest/lib/src/description.dart

Issue 16408019: Improved error messages from unittest. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
11 */ 11 */
12 class StringDescription implements Description { 12 class StringDescription implements Description {
13 var _out; 13 var _out;
14 14
15 /** Initialize the description with initial contents [init]. */ 15 /** Initialize the description with initial contents [init]. */
16 StringDescription([String init = '']) { 16 StringDescription([String init = '']) {
17 _out = init; 17 _out = init;
18 } 18 }
19 19
20 int get length => _out.length;
21
20 /** Get the description as a string. */ 22 /** Get the description as a string. */
21 String toString() => _out; 23 String toString() => _out;
22 24
23 /** Append some plain [text] to the description. */ 25 /** Append [text] to the description. */
24 Description add(String text) { 26 Description add(text) {
25 _out = '${_out}${text}'; 27 _out = '${_out}${text}';
26 return this; 28 return this;
27 } 29 }
28 30
29 /** Change the value of the description. */ 31 /** Change the value of the description. */
30 Description replace(String text) { 32 Description replace(String text) {
31 _out = text; 33 _out = text;
32 return this; 34 return this;
33 } 35 }
34 36
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return this; 69 return this;
68 } 70 }
69 71
70 /** Escape the control characters in [string] so that they are visible. */ 72 /** Escape the control characters in [string] so that they are visible. */
71 _addEscapedString(String string) { 73 _addEscapedString(String string) {
72 add("'"); 74 add("'");
73 add(escapeString(string)); 75 add(escapeString(string));
74 add("'"); 76 add("'");
75 } 77 }
76 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698