| 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 /** This file is sourced by unitest.dart. */ | 5 /** This file is sourced by unitest.dart. */ |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // An exception is used by the test infrastructure to detect failure. | 122 // An exception is used by the test infrastructure to detect failure. |
| 123 if (!success) throw new Exception("Some tests failed."); | 123 if (!success) throw new Exception("Some tests failed."); |
| 124 } | 124 } |
| 125 | 125 |
| 126 String _indent(String str) { | 126 String _indent(String str) { |
| 127 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. | 127 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. |
| 128 // return str.replaceAll(const RegExp("^", multiLine: true), " "); | 128 // return str.replaceAll(const RegExp("^", multiLine: true), " "); |
| 129 | 129 |
| 130 return Strings.join(str.split("\n").map((line) => " $line"), "\n"); | 130 return Strings.join(str.split("\n").map((line) => " $line"), "\n"); |
| 131 } | 131 } |
| 132 |
| 133 /** Handle errors that happen outside the tests. */ |
| 134 // TODO(vsm): figure out how to expose the stack trace here |
| 135 // Currently e.message works in dartium, but not in dartc. |
| 136 handleExternalError(e, String message) => |
| 137 _reportTestError('$message\nCaught $e', ''); |
| 132 } | 138 } |
| OLD | NEW |