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

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

Issue 208273009: pkg/unittest: Removed references to expectAsync[Until]X in docs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 9 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/lib/src/spread_args_helper.dart ('k') | pkg/unittest/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/test_case.dart
diff --git a/pkg/unittest/lib/src/test_case.dart b/pkg/unittest/lib/src/test_case.dart
index d4802ea8ce1b6d36ac72afa8621c8471e3ddc095..0948e79e1979af6b3d59457e6bb52f8168ac9b7f 100644
--- a/pkg/unittest/lib/src/test_case.dart
+++ b/pkg/unittest/lib/src/test_case.dart
@@ -4,51 +4,45 @@
part of unittest;
-/**
- * Represents the state for an individual unit test.
- *
- * Create by calling [test] or [solo_test].
- */
+/// Represents the state for an individual unit test.
+///
+/// Create by calling [test] or [solo_test].
class TestCase {
- /** Identifier for this test. */
+ /// Identifier for this test.
final int id;
- /** A description of what the test is specifying. */
+ /// A description of what the test is specifying.
final String description;
- /** The setup function to call before the test, if any. */
+ /// The setup function to call before the test, if any.
final Function _setUp;
- /** The teardown function to call after the test, if any. */
+ /// The teardown function to call after the test, if any.
final Function _tearDown;
- /** The body of the test case. */
+ /// The body of the test case.
final TestFunction _testFunction;
- /**
- * Remaining number of callbacks functions that must reach a 'done' state
- * to wait for before the test completes.
- */
+ /// Remaining number of callbacks functions that must reach a 'done' state
+ /// to wait for before the test completes.
int _callbackFunctionsOutstanding = 0;
String _message = '';
- /** Error or failure message. */
+ /// Error or failure message.
String get message => _message;
String _result;
- /**
- * One of [PASS], [FAIL], [ERROR], or [:null:] if the test hasn't run yet.
- */
+ /// One of [PASS], [FAIL], [ERROR], or [:null:] if the test hasn't run yet.
String get result => _result;
- /** Returns whether this test case passed. */
+ /// Returns whether this test case passed.
bool get passed => _result == PASS;
StackTrace _stackTrace;
- /** Stack trace associated with this test, or [:null:] if it succeeded. */
+ /// Stack trace associated with this test, or [:null:] if it succeeded.
StackTrace get stackTrace => _stackTrace;
- /** The group (or groups) under which this test is running. */
+ /// The group (or groups) under which this test is running.
final String currentGroup;
DateTime _startTime;
@@ -85,12 +79,10 @@ class TestCase {
}
};
- /**
- * Perform any associated [_setUp] function and run the test. Returns
- * a [Future] that can be used to schedule the next test. If the test runs
- * to completion synchronously, or is disabled, null is returned, to
- * tell unittest to schedule the next test immediately.
- */
+ /// Perform any associated [_setUp] function and run the test. Returns
+ /// a [Future] that can be used to schedule the next test. If the test runs
+ /// to completion synchronously, or is disabled, null is returned, to
+ /// tell unittest to schedule the next test immediately.
Future _run() {
if (!enabled) return new Future.value();
@@ -100,32 +92,28 @@ class TestCase {
// Avoid calling [new Future] to avoid issue 11911.
return new Future.value().then((_) {
if (_setUp != null) return _setUp();
- }).catchError(_errorHandler('Setup'))
- .then((_) {
- // Skip the test if setup failed.
- if (result != null) return new Future.value();
- _config.onTestStart(this);
- _startTime = new DateTime.now();
- _runningTime = null;
- ++_callbackFunctionsOutstanding;
- return _testFunction();
- })
- .catchError(_errorHandler('Test'))
- .then((_) {
- _markCallbackComplete();
- if (result == null) {
- // Outstanding callbacks exist; we need to return a Future.
- _testComplete = new Completer();
- return _testComplete.future.whenComplete(() {
- if (_tearDown != null) {
- return _tearDown();
- }
- }).catchError(_errorHandler('Teardown'));
- } else if (_tearDown != null) {
+ }).catchError(_errorHandler('Setup')).then((_) {
+ // Skip the test if setup failed.
+ if (result != null) return new Future.value();
+ _config.onTestStart(this);
+ _startTime = new DateTime.now();
+ _runningTime = null;
+ ++_callbackFunctionsOutstanding;
+ return _testFunction();
+ }).catchError(_errorHandler('Test')).then((_) {
+ _markCallbackComplete();
+ if (result == null) {
+ // Outstanding callbacks exist; we need to return a Future.
+ _testComplete = new Completer();
+ return _testComplete.future.whenComplete(() {
+ if (_tearDown != null) {
return _tearDown();
}
- })
- .catchError(_errorHandler('Teardown'));
+ }).catchError(_errorHandler('Teardown'));
+ } else if (_tearDown != null) {
+ return _tearDown();
+ }
+ }).catchError(_errorHandler('Teardown'));
}
// Set the results, notify the config, and return true if this
« no previous file with comments | « pkg/unittest/lib/src/spread_args_helper.dart ('k') | pkg/unittest/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698