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

Unified Diff: client/testing/unittest/unittest.dart

Issue 9022042: Hacking format of Expect failure messages to play nice with rendered HTML. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/testing/unittest/unittest.dart
===================================================================
--- client/testing/unittest/unittest.dart (revision 2886)
+++ client/testing/unittest/unittest.dart (working copy)
@@ -92,13 +92,17 @@
<tr>
<td>${test_.id}</td>
<td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td>
- <td>Expectation: ${test_.description}. ${test_.message}</td>
+ <td>Expectation: ${test_.description}. ${_sanitize(test_.message)}</td>
</tr>''';
if (test_.stackTrace != null) {
html +=
- '<tr><td></td><td colspan="2"><pre>${test_.stackTrace}</pre></td></tr>';
+ '<tr><td></td><td colspan="2"><pre>${_sanitize(test_.stackTrace)}</pre></td></tr>';
}
return html;
}
+
+String _sanitize(String string) {
Siggi Cherem (dart-lang) 2012/01/04 16:28:36 _sanitize -> _htmlEscape ?
+ return string.replaceAll('<','&lt;').replaceAll('>','&gt;');
Siggi Cherem (dart-lang) 2012/01/04 16:28:36 add also '&amp;'
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698