Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * A simple unit test library for running tests in a browser. | 6 * A simple unit test library for running tests in a browser. |
| 7 */ | 7 */ |
| 8 #library("unittest"); | 8 #library("unittest"); |
| 9 | 9 |
| 10 #import("dart:dom"); | 10 #import("dart:dom"); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 <td>${test_.id}</td> | 85 <td>${test_.id}</td> |
| 86 <td class="unittest-error">NO STATUS</td> | 86 <td class="unittest-error">NO STATUS</td> |
| 87 <td>Test did not complete</td> | 87 <td>Test did not complete</td> |
| 88 </tr>'''; | 88 </tr>'''; |
| 89 } | 89 } |
| 90 | 90 |
| 91 var html = ''' | 91 var html = ''' |
| 92 <tr> | 92 <tr> |
| 93 <td>${test_.id}</td> | 93 <td>${test_.id}</td> |
| 94 <td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td> | 94 <td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td> |
| 95 <td>Expectation: ${test_.description}. ${test_.message}</td> | 95 <td>Expectation: ${test_.description}. ${_sanitize(test_.message)}</td> |
| 96 </tr>'''; | 96 </tr>'''; |
| 97 | 97 |
| 98 if (test_.stackTrace != null) { | 98 if (test_.stackTrace != null) { |
| 99 html += | 99 html += |
| 100 '<tr><td></td><td colspan="2"><pre>${test_.stackTrace}</pre></td></tr>'; | 100 '<tr><td></td><td colspan="2"><pre>${_sanitize(test_.stackTrace)}</pre>< /td></tr>'; |
| 101 } | 101 } |
| 102 | 102 |
| 103 return html; | 103 return html; |
| 104 } | 104 } |
| 105 | |
| 106 String _sanitize(String string) { | |
|
Siggi Cherem (dart-lang)
2012/01/04 16:28:36
_sanitize -> _htmlEscape ?
| |
| 107 return string.replaceAll('<','<').replaceAll('>','>'); | |
|
Siggi Cherem (dart-lang)
2012/01/04 16:28:36
add also '&'
| |
| 108 } | |
| OLD | NEW |