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

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

Issue 11451017: Make the unittest framework more robust wrt asynchronous tests. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/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 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.
}
« 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