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

Side by Side Diff: pkg/unittest/lib/src/config.dart

Issue 13251003: pkg/unittest: readonly view of testCase collection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nit Created 7 years, 9 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
« no previous file with comments | « no previous file | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of unittest; 5 part of unittest;
6 6
7 /** 7 /**
8 * Hooks to configure the unittest library for different platforms. This class 8 * Hooks to configure the unittest library for different platforms. This class
9 * implements the API in a platform-independent way. Tests that want to take 9 * implements the API in a platform-independent way. Tests that want to take
10 * advantage of the platform can create a subclass and override methods from 10 * advantage of the platform can create a subclass and override methods from
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 /** Called as soon as the unittest framework starts running. */ 44 /** Called as soon as the unittest framework starts running. */
45 void onStart() {} 45 void onStart() {}
46 46
47 /** 47 /**
48 * Called when each test starts. Useful to show intermediate progress on 48 * Called when each test starts. Useful to show intermediate progress on
49 * a test suite. 49 * a test suite.
50 */ 50 */
51 void onTestStart(TestCase testCase) { 51 void onTestStart(TestCase testCase) {
52 assert(testCase != null);» 52 assert(testCase != null);
53 } 53 }
54 54
55 /** 55 /**
56 * Called when each test is first completed. Useful to show intermediate 56 * Called when each test is first completed. Useful to show intermediate
57 * progress on a test suite. 57 * progress on a test suite.
58 */ 58 */
59 void onTestResult(TestCase testCase) { 59 void onTestResult(TestCase testCase) {
60 assert(testCase != null);» 60 assert(testCase != null);
61 } 61 }
62 62
63 /** 63 /**
64 * Called when an already completed test changes state; for example a test 64 * Called when an already completed test changes state; for example a test
65 * that was marked as passing may later be marked as being in error because 65 * that was marked as passing may later be marked as being in error because
66 * it still had callbacks being invoked. 66 * it still had callbacks being invoked.
67 */ 67 */
68 void onTestResultChanged(TestCase testCase) { 68 void onTestResultChanged(TestCase testCase) {
69 assert(testCase != null); 69 assert(testCase != null);
70 } 70 }
(...skipping 25 matching lines...) Expand all
96 * Called with the result of all test cases. The default implementation prints 96 * Called with the result of all test cases. The default implementation prints
97 * the result summary using the built-in [print] command. Browser tests 97 * the result summary using the built-in [print] command. Browser tests
98 * commonly override this to reformat the output. 98 * commonly override this to reformat the output.
99 * 99 *
100 * When [uncaughtError] is not null, it contains an error that occured outside 100 * When [uncaughtError] is not null, it contains an error that occured outside
101 * of tests (e.g. setting up the test). 101 * of tests (e.g. setting up the test).
102 */ 102 */
103 void onSummary(int passed, int failed, int errors, List<TestCase> results, 103 void onSummary(int passed, int failed, int errors, List<TestCase> results,
104 String uncaughtError) { 104 String uncaughtError) {
105 // Print each test's result. 105 // Print each test's result.
106 for (final t in _tests) { 106 for (final t in testCases) {
107 var resultString = "${t.result}".toUpperCase(); 107 var resultString = "${t.result}".toUpperCase();
108 print('$resultString: ${t.description}'); 108 print('$resultString: ${t.description}');
109 109
110 if (t.message != '') { 110 if (t.message != '') {
111 print(_indent(t.message)); 111 print(_indent(t.message));
112 } 112 }
113 113
114 if (t.stackTrace != null && t.stackTrace != '') { 114 if (t.stackTrace != null && t.stackTrace != '') {
115 print(_indent(t.stackTrace)); 115 print(_indent(t.stackTrace));
116 } 116 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Currently e.message works in dartium, but not in dartc. 160 // Currently e.message works in dartium, but not in dartc.
161 void handleExternalError(e, String message, [String stack = '']) => 161 void handleExternalError(e, String message, [String stack = '']) =>
162 _reportTestError('$message\nCaught $e', stack); 162 _reportTestError('$message\nCaught $e', stack);
163 163
164 _postMessage(String message) { 164 _postMessage(String message) {
165 // In dart2js browser tests, the JavaScript-based test controller 165 // In dart2js browser tests, the JavaScript-based test controller
166 // intercepts calls to print and listens for "secret" messages. 166 // intercepts calls to print and listens for "secret" messages.
167 print(message); 167 print(message);
168 } 168 }
169 } 169 }
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698