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

Side by Side Diff: lib/unittest/test_case.dart

Issue 10168022: Enhanced HTML test look & feel, thanks to John Evans (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: newline 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * testcase.dart: this file is sourced by unittest.dart. It defines [TestCase] 6 * testcase.dart: this file is sourced by unittest.dart. It defines [TestCase]
7 * and assumes unittest defines the type [TestFunction]. 7 * and assumes unittest defines the type [TestFunction].
8 */ 8 */
9 9
10
10 /** Summarizes information about a single test case. */ 11 /** Summarizes information about a single test case. */
11 class TestCase { 12 class TestCase {
12 /** Identifier for this test. */ 13 /** Identifier for this test. */
13 final int id; 14 final int id;
14 15
15 /** A description of what the test is specifying. */ 16 /** A description of what the test is specifying. */
16 final String description; 17 final String description;
17 18
18 /** The body of the test case. */ 19 /** The body of the test case. */
19 final TestFunction test; 20 final TestFunction test;
20 21
21 /** Total number of callbacks to wait for before the test completes. */ 22 /** Total number of callbacks to wait for before the test completes. */
22 int callbacks; 23 int callbacks;
23 24
24 /** Error or failure message. */ 25 /** Error or failure message. */
25 String message = ''; 26 String message = '';
26 27
27 /** 28 /**
28 * One of [_PASS], [_FAIL], or [_ERROR] or [null] if the test hasn't run yet. 29 * One of [_PASS], [_FAIL], or [_ERROR] or [null] if the test hasn't run yet.
29 */ 30 */
30 String result; 31 String result;
31 32
32 /** Stack trace associated with this test, or null if it succeeded. */ 33 /** Stack trace associated with this test, or null if it succeeded. */
33 String stackTrace; 34 String stackTrace;
34 35
36 /** The group (or groups) under which this test is running. */
37 final String currentGroup;
38
35 Date startTime; 39 Date startTime;
36 40
37 Duration runningTime; 41 Duration runningTime;
38 42
39 TestCase(this.id, this.description, this.test, this.callbacks); 43 TestCase(this.id, this.description, this.test, this.callbacks)
44 : currentGroup = _currentGroup;
40 45
41 bool get isComplete() => result != null; 46 bool get isComplete() => result != null;
42 47
43 void pass() { 48 void pass() {
44 result = _PASS; 49 result = _PASS;
45 } 50 }
46 51
47 void fail(String message, String stackTrace) { 52 void fail(String message, String stackTrace) {
48 result = _FAIL; 53 result = _FAIL;
49 this.message = message; 54 this.message = message;
50 this.stackTrace = stackTrace; 55 this.stackTrace = stackTrace;
51 } 56 }
52 57
53 void error(String message, String stackTrace) { 58 void error(String message, String stackTrace) {
54 result = _ERROR; 59 result = _ERROR;
55 this.message = message; 60 this.message = message;
56 this.stackTrace = stackTrace; 61 this.stackTrace = stackTrace;
57 } 62 }
58 } 63 }
59
60
OLDNEW
« lib/unittest/html_enhanced_config.dart ('K') | « lib/unittest/html_enhanced_config.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698