| 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 part of unittest; | 5 part of unittest; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Hooks to configure the unittest library for different platforms. This class | 8 * Hooks to configure the unittest library for different platforms. This class |
| 9 * implements the API in a platform-independent way. Tests that want to take | 9 * implements the API in a platform-independent way. Tests that want to take |
| 10 * advantage of the platform can create a subclass and override methods from | 10 * advantage of the platform can create a subclass and override methods from |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 String _indent(String str) { | 151 String _indent(String str) { |
| 152 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. | 152 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. |
| 153 // return str.replaceAll(new RegExp("^", multiLine: true), " "); | 153 // return str.replaceAll(new RegExp("^", multiLine: true), " "); |
| 154 | 154 |
| 155 return str.split("\n").map((line) => " $line").join("\n"); | 155 return str.split("\n").map((line) => " $line").join("\n"); |
| 156 } | 156 } |
| 157 | 157 |
| 158 /** Handle errors that happen outside the tests. */ | 158 /** Handle errors that happen outside the tests. */ |
| 159 // TODO(vsm): figure out how to expose the stack trace here | 159 // TODO(vsm): figure out how to expose the stack trace here |
| 160 // Currently e.message works in dartium, but not in dartc. | 160 // Currently e.message works in dartium, but not in dartc. |
| 161 handleExternalError(e, String message) => | 161 void handleExternalError(e, String message) => |
| 162 _reportTestError('$message\nCaught $e', ''); | 162 _reportTestError('$message\nCaught $e', ''); |
| 163 | 163 |
| 164 _postMessage(String message) { | 164 _postMessage(String message) { |
| 165 // In dart2js browser tests, the JavaScript-based test controller | 165 // In dart2js browser tests, the JavaScript-based test controller |
| 166 // intercepts calls to print and listens for "secret" messages. | 166 // intercepts calls to print and listens for "secret" messages. |
| 167 print(message); | 167 print(message); |
| 168 } | 168 } |
| 169 } | 169 } |
| OLD | NEW |