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

Unified Diff: lib/unittest/testcase.dart

Issue 10037027: unittest step2: bye bye to multiple entrypoints for unittest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
Index: lib/unittest/testcase.dart
diff --git a/lib/unittest/testcase.dart b/lib/unittest/testcase.dart
new file mode 100644
index 0000000000000000000000000000000000000000..23eef81002bd602f9bcfb54c8e848b38c4f537f2
--- /dev/null
+++ b/lib/unittest/testcase.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2011, 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.
+
+/**
+ * testcase.dart: this file is sourced by unittest.dart. It defines [TestCase]
+ * and assumes unittest defines the type [TestFunction].
+ */
+
+/** Summarizes information about a single test case. */
+class TestCase {
Siggi Cherem (dart-lang) 2012/04/12 01:13:53 ditto (unchanged, moved to its own file)
+ /** Identifier for this test. */
+ final id;
Bob Nystrom 2012/04/12 16:45:49 Type?
Siggi Cherem (dart-lang) 2012/04/12 17:36:28 Done.
+
+ /** A description of what the test is specifying. */
+ final String description;
+
+ /** The body of the test case. */
+ final TestFunction test;
+
+ /** Total number of callbacks to wait for before the test completes. */
+ int callbacks;
+
+ /** Error or failure message. */
+ String message = '';
+
+ /**
+ * One of [_PASS], [_FAIL], or [_ERROR] or [null] if the test hasn't run yet.
+ */
+ String result;
+
+ /** Stack trace associated with this test, or null if it succeeded. */
+ String stackTrace;
+
+ Date startTime;
+
+ Duration runningTime;
+
+ TestCase(this.id, this.description, this.test, this.callbacks);
+
+ bool get isComplete() => result != null;
+
+ void pass() {
+ result = _PASS;
+ }
+
+ void fail(String message_, String stackTrace_) {
Bob Nystrom 2012/04/12 16:45:49 Are the trailing underscores needed here?
Siggi Cherem (dart-lang) 2012/04/12 17:36:28 Done.
+ result = _FAIL;
+ this.message = message_;
Bob Nystrom 2012/04/12 16:45:49 If they are, then get rid of "this." here.
Siggi Cherem (dart-lang) 2012/04/12 17:36:28 Done.
+ this.stackTrace = stackTrace_;
+ }
+
+ void error(String message_, String stackTrace_) {
+ result = _ERROR;
+ this.message = message_;
+ this.stackTrace = stackTrace_;
+ }
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698