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

Unified Diff: pkg/unittest/lib/src/config.dart

Issue 11645022: Use Receive ports to make sure the VM doesn't shut down with async tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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: pkg/unittest/lib/src/config.dart
diff --git a/pkg/unittest/lib/src/config.dart b/pkg/unittest/lib/src/config.dart
index cd0f365b3be5d613fdedfb348fde7b4010411d3b..f0cf526e882baff7b58aebc114a0d545c795076f 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();
+ 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.');
}
« 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