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

Unified Diff: lib/unittest/test_case.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
« no previous file with comments | « lib/unittest/shared.dart ('k') | lib/unittest/unittest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/unittest/test_case.dart
diff --git a/lib/unittest/test_case.dart b/lib/unittest/test_case.dart
new file mode 100644
index 0000000000000000000000000000000000000000..02aea4399361a1ce232dcf2a41d4e082e7fcf3e4
--- /dev/null
+++ b/lib/unittest/test_case.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 {
+ /** Identifier for this test. */
+ final int id;
+
+ /** 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) {
+ result = _FAIL;
+ this.message = message;
+ this.stackTrace = stackTrace;
+ }
+
+ void error(String message, String stackTrace) {
+ result = _ERROR;
+ this.message = message;
+ this.stackTrace = stackTrace;
+ }
+}
+
+
« no previous file with comments | « lib/unittest/shared.dart ('k') | lib/unittest/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698