OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** | |
6 * testcase.dart: this file is sourced by unittest.dart. It defines [TestCase] | |
7 * and assumes unittest defines the type [TestFunction]. | |
8 */ | |
9 | |
10 /** Summarizes information about a single test case. */ | |
11 class TestCase { | |
Siggi Cherem (dart-lang)
2012/04/12 01:13:53
ditto (unchanged, moved to its own file)
| |
12 /** Identifier for this test. */ | |
13 final id; | |
Bob Nystrom
2012/04/12 16:45:49
Type?
Siggi Cherem (dart-lang)
2012/04/12 17:36:28
Done.
| |
14 | |
15 /** A description of what the test is specifying. */ | |
16 final String description; | |
17 | |
18 /** The body of the test case. */ | |
19 final TestFunction test; | |
20 | |
21 /** Total number of callbacks to wait for before the test completes. */ | |
22 int callbacks; | |
23 | |
24 /** Error or failure message. */ | |
25 String message = ''; | |
26 | |
27 /** | |
28 * One of [_PASS], [_FAIL], or [_ERROR] or [null] if the test hasn't run yet. | |
29 */ | |
30 String result; | |
31 | |
32 /** Stack trace associated with this test, or null if it succeeded. */ | |
33 String stackTrace; | |
34 | |
35 Date startTime; | |
36 | |
37 Duration runningTime; | |
38 | |
39 TestCase(this.id, this.description, this.test, this.callbacks); | |
40 | |
41 bool get isComplete() => result != null; | |
42 | |
43 void pass() { | |
44 result = _PASS; | |
45 } | |
46 | |
47 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.
| |
48 result = _FAIL; | |
49 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.
| |
50 this.stackTrace = stackTrace_; | |
51 } | |
52 | |
53 void error(String message_, String stackTrace_) { | |
54 result = _ERROR; | |
55 this.message = message_; | |
56 this.stackTrace = stackTrace_; | |
57 } | |
58 } | |
59 | |
60 | |
OLD | NEW |