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

Unified Diff: pkg/unittest/test/utils.dart

Issue 524153002: Sharing metatest logic between unittest and scheduled_test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: status fixes Created 6 years, 3 months 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 | « pkg/unittest/test/testcases_immutable_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/test/utils.dart
diff --git a/pkg/unittest/test/utils.dart b/pkg/unittest/test/utils.dart
deleted file mode 100644
index 553d359f4bba686f9456b1bc851032b260ed45f7..0000000000000000000000000000000000000000
--- a/pkg/unittest/test/utils.dart
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of unittestTest;
-
-/**
- * Schedule [fn] for future execution in an event handler.
- */
-Future _defer(void fn()) {
- return new Future(fn);
-}
-
-String buildStatusString(int passed, int failed, int errors,
- var results,
- {int count: 0,
- String setup: '', String teardown: '',
- String uncaughtError: null,
- String message: ''}) {
- var totalTests = 0;
- var testDetails = new StringBuffer();
- if (results == null) {
- // no op
- assert(message == '');
- } else if (results is String) {
- totalTests = passed + failed + errors;
- testDetails.write(':$results:$message');
- } else {
- totalTests = results.length;
- for (var i = 0; i < results.length; i++) {
- testDetails.write(':${results[i].description}:'
- '${collapseWhitespace(results[i].message)}');
- }
- }
- return '$passed:$failed:$errors:$totalTests:$count:'
- '$setup:$teardown:$uncaughtError$testDetails';
-}
-
-class TestConfiguration extends Configuration {
-
- // Some test state that is captured.
- int count = 0; // A count of callbacks.
- String setup = ''; // The name of the test group setup function, if any.
- String teardown = ''; // The name of the group teardown function, if any.
-
- // The port to communicate with the parent isolate
- final SendPort _port;
- String _result;
-
- TestConfiguration(this._port): super.blank();
-
- void onSummary(int passed, int failed, int errors, List<TestCase> results,
- String uncaughtError) {
- _result = buildStatusString(passed, failed, errors, results,
- count: count, setup: setup, teardown: teardown,
- uncaughtError: uncaughtError);
- }
-
- void onDone(bool success) {
- _port.send(_result);
- }
-}
-
-Function makeDelayedSetup(index, s) => () {
- return new Future.delayed(new Duration(milliseconds: 1), () {
- s.write('l$index U ');
- });
-};
-
-Function makeDelayedTeardown(index, s) => () {
- return new Future.delayed(new Duration(milliseconds: 1), () {
- s.write('l$index D ');
- });
-};
-
-Function makeImmediateSetup(index, s) => () {
- s.write('l$index U ');
-};
-
-Function makeImmediateTeardown(index, s) => () {
- s.write('l$index D ');
-};
-
-void runTestInIsolate(sendport) {
- var testConfig = new TestConfiguration(sendport);
- unittestConfiguration = testConfig;
- testFunction(testConfig);
-}
-
-void main() {
- var replyPort = new ReceivePort();
- Isolate.spawn(runTestInIsolate, replyPort.sendPort);
- replyPort.first.then((String msg) {
- expect(msg.trim(), expected);
- });
-}
« no previous file with comments | « pkg/unittest/test/testcases_immutable_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698