Chromium Code Reviews| Index: pkg/unittest/lib/src/config.dart |
| diff --git a/pkg/unittest/lib/src/config.dart b/pkg/unittest/lib/src/config.dart |
| index 1913125bfc5fc66c90ba533d426a8d0e03b25ac1..75a7d9f1e8f1bca448a68f860f093acc023c58c7 100644 |
| --- a/pkg/unittest/lib/src/config.dart |
| +++ b/pkg/unittest/lib/src/config.dart |
| @@ -12,6 +12,9 @@ part of unittest; |
| */ |
| class Configuration { |
| + // The VM won't shut down if a receive port is open. Use this to make sure |
| + // we correctly wait for asynchronous tests. |
| + ReceivePort _receivePort; |
| TestCase currentTestCase = null; |
| /** |
| @@ -39,6 +42,7 @@ class Configuration { |
| * wait until they are done. |
| */ |
| void onStart() { |
| + _receivePort = new ReceivePort(); |
| _postMessage('unittest-suite-wait-for-done'); |
| } |
| @@ -96,7 +100,8 @@ class Configuration { |
| String uncaughtError) { |
| // Print each test's result. |
| for (final t in _tests) { |
| - print('${t.result.toUpperCase()}: ${t.description}'); |
| + var resultString = "${t.result}".toUpperCase(); |
|
floitsch
2012/12/05 19:39:50
I got null-pointer exceptions on "toUpperCase". Ha
|
| + print('$resultString: ${t.description}'); |
| if (t.message != '') { |
| print(_indent(t.message)); |
| @@ -126,6 +131,7 @@ class Configuration { |
| if (success) { |
| _postMessage('unittest-suite-success'); |
| + _receivePort.close(); |
| } else { |
| throw new Exception('Some tests failed.'); |
|
siva
2012/12/20 21:27:20
The _receivePort should be closed on the exception
floitsch
2012/12/21 08:25:43
https://codereview.chromium.org/11570065
thanks.
|
| } |