OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // TODO(gram): dart2js is not handling 'part of' properly yet; when it does | 5 // TODO(gram): dart2js is not handling 'part of' properly yet; when it does |
6 // uncomment this. | 6 // uncomment this. |
7 //part of test_controller; | 7 //part of test_controller; |
8 | 8 |
9 /** Path to DRT executable. */ | 9 /** Path to DRT executable. */ |
10 String drt; | 10 String drt; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } else if (failed == 0 && errors == 0 && uncaughtError == null) { | 108 } else if (failed == 0 && errors == 0 && uncaughtError == null) { |
109 tprint('$testfile: All $passed tests passed.'); | 109 tprint('$testfile: All $passed tests passed.'); |
110 } else { | 110 } else { |
111 if (uncaughtError != null) { | 111 if (uncaughtError != null) { |
112 tprint('$testfile: Top-level uncaught error: $uncaughtError'); | 112 tprint('$testfile: Top-level uncaught error: $uncaughtError'); |
113 } | 113 } |
114 tprint('$testfile: $passed PASSED, $failed FAILED, $errors ERRORS'); | 114 tprint('$testfile: $passed PASSED, $failed FAILED, $errors ERRORS'); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 void onDone(int passed, int failed, int errors, | 118 void onSummary(int passed, int failed, int errors, |
119 List<unittest.TestCase> results, | 119 List<unittest.TestCase> results, String uncaughtError) { |
120 String uncaughtError) { | |
121 var success = (passed > 0 && failed == 0 && errors == 0 && | |
122 uncaughtError == null); | |
123 if (!immediate) { | 120 if (!immediate) { |
124 for (final testCase in results) { | 121 for (final testCase in results) { |
125 dumpTestResult('$testfile ', testCase); | 122 dumpTestResult('$testfile ', testCase); |
126 } | 123 } |
127 } | 124 } |
128 if (summarize) { | 125 if (summarize) { |
129 printSummary(passed, failed, errors, uncaughtError); | 126 printSummary(passed, failed, errors, uncaughtError); |
130 } | 127 } |
| 128 } |
| 129 |
| 130 void onDone(bool success) { |
131 if (notifyDone != null) { | 131 if (notifyDone != null) { |
132 notifyDone(success ? 0 : -1); | 132 notifyDone(success ? 0 : -1); |
133 } | 133 } |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 // Support for listing tests and groups. We use a minimal config. | 137 // Support for listing tests and groups. We use a minimal config. |
138 class MinimalTestRunnerConfiguration extends unittest.Configuration { | 138 class MinimalTestRunnerConfiguration extends unittest.Configuration { |
139 get name => 'Minimal test runner configuration'; | 139 get name => 'Minimal test runner configuration'; |
140 get autoStart => false; | 140 get autoStart => false; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 notifyDone(0); | 188 notifyDone(0); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 // Support for running in isolates. | 192 // Support for running in isolates. |
193 | 193 |
194 class TestRunnerChildConfiguration extends unittest.Configuration { | 194 class TestRunnerChildConfiguration extends unittest.Configuration { |
195 get name => 'Test runner child configuration'; | 195 get name => 'Test runner child configuration'; |
196 get autoStart => false; | 196 get autoStart => false; |
197 | 197 |
198 void onDone(int passed, int failed, int errors, | 198 void onSummary(int passed, int failed, int errors, |
199 List<unittest.TestCase> results, String uncaughtError) { | 199 List<unittest.TestCase> results, String uncaughtError) { |
200 unittest.TestCase test = results[0]; | 200 unittest.TestCase test = results[0]; |
201 parentPort.send([test.result, test.runningTime.inMilliseconds, | 201 parentPort.send([test.result, test.runningTime.inMilliseconds, |
202 test.message, test.stackTrace]); | 202 test.message, test.stackTrace]); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 var parentPort; | 206 var parentPort; |
207 runChildTest() { | 207 runChildTest() { |
208 port.receive((testName, sendport) { | 208 port.receive((testName, sendport) { |
209 parentPort = sendport; | 209 parentPort = sendport; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 process(testMain, action) { | 278 process(testMain, action) { |
279 unittest.groupSep = '###'; | 279 unittest.groupSep = '###'; |
280 unittest.configure(new TestRunnerConfiguration()); | 280 unittest.configure(new TestRunnerConfiguration()); |
281 unittest.group('', testMain); | 281 unittest.group('', testMain); |
282 // Do any user-specified test filtering. | 282 // Do any user-specified test filtering. |
283 unittest.filterTests(filterTest); | 283 unittest.filterTests(filterTest); |
284 action(); | 284 action(); |
285 } | 285 } |
OLD | NEW |