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

Unified Diff: lib/unittest/test_case.dart

Issue 10836241: Move unittest from lib to pkg. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/string_matchers.dart ('k') | lib/unittest/test_controller.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/unittest/test_case.dart
===================================================================
--- lib/unittest/test_case.dart (revision 10655)
+++ lib/unittest/test_case.dart (working copy)
@@ -1,110 +0,0 @@
-// 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 setup function to call before the test, if any. */
- Function _setUp;
-
- Function get setUp() => _setUp;
- set setUp(Function value) => _setUp = value;
-
- /** The teardown function to call after the test, if any. */
- Function _tearDown;
-
- Function get tearDown() => _tearDown;
- set tearDown(Function value) => _tearDown = value;
-
- /** The body of the test case. */
- TestFunction test;
-
- /**
- * Remaining number of callbacks functions that must reach a 'done' state
- * to wait for before the test completes.
- */
- int callbackFunctionsOutstanding;
-
- /** Error or failure message. */
- String message = '';
-
- /**
- * One of [_PASS], [_FAIL], [_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;
-
- /** The group (or groups) under which this test is running. */
- final String currentGroup;
-
- Date startTime;
-
- Duration runningTime;
-
- bool enabled = true;
-
- bool _doneTeardown;
-
- TestCase(this.id, this.description, this.test,
- this.callbackFunctionsOutstanding)
- : currentGroup = _currentGroup,
- _setUp = _testSetup,
- _tearDown = _testTeardown;
-
- bool get isComplete() => !enabled || result != null;
-
- void run() {
- if (enabled) {
- result = stackTrace = null;
- message = '';
- _doneTeardown = false;
- if (_setUp != null) {
- _setUp();
- }
- _config.onTestStart(this);
- test();
- }
- }
-
- void _complete() {
- if (!_doneTeardown) {
- if (_tearDown != null) {
- _tearDown();
- }
- _doneTeardown = true;
- }
- _config.onTestResult(this);
- }
-
- void pass() {
- result = _PASS;
- _complete();
- }
-
- void fail(String messageText, String stack) {
- result = _FAIL;
- message = messageText;
- stackTrace = stack;
- _complete();
- }
-
- void error(String messageText, String stack) {
- result = _ERROR;
- message = messageText;
- stackTrace = stack;
- _complete();
- }
-}
« no previous file with comments | « lib/unittest/string_matchers.dart ('k') | lib/unittest/test_controller.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698