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 part of test_controller; | 5 part of test_controller; |
6 | 6 |
7 /** Path to DRT executable. */ | 7 /** Path to DRT executable. */ |
8 String drt; | 8 String drt; |
9 | 9 |
10 /** Whether to include elapsed time. */ | 10 /** Whether to include elapsed time. */ |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 /** A callback function to notify the caller we are done. */ | 35 /** A callback function to notify the caller we are done. */ |
36 Function notifyDone; | 36 Function notifyDone; |
37 | 37 |
38 /** The action function to use. */ | 38 /** The action function to use. */ |
39 Function action; | 39 Function action; |
40 | 40 |
41 /** | 41 /** |
42 * A special marker string used to separate group names and | 42 * A special marker string used to separate group names and |
43 * identify non-debug output. | 43 * identify non-debug output. |
44 */ | 44 */ |
45 final marker = '###'; | 45 final marker = '###'; |
46 | 46 |
47 class Macros { | 47 class Macros { |
48 static const String testTime = '<TIME>'; | 48 static const String testTime = '<TIME>'; |
49 static const String testfile = '<FILENAME>'; | 49 static const String testfile = '<FILENAME>'; |
50 static const String testGroup = '<GROUPNAME>'; | 50 static const String testGroup = '<GROUPNAME>'; |
51 static const String testDescription = '<TESTNAME>'; | 51 static const String testDescription = '<TESTNAME>'; |
52 static const String testMessage = '<MESSAGE>'; | 52 static const String testMessage = '<MESSAGE>'; |
53 static const String testStacktrace = '<STACK>'; | 53 static const String testStacktrace = '<STACK>'; |
54 } | 54 } |
55 | 55 |
56 class TestRunnerConfiguration extends Configuration { | 56 class TestRunnerConfiguration extends SimpleConfiguration { |
57 get name => 'Minimal test runner configuration'; | 57 get name => 'Minimal test runner configuration'; |
58 get autoStart => false; | 58 get autoStart => false; |
59 | 59 |
60 void onInit() {} | 60 void onInit() {} |
61 | 61 |
62 String formatMessage(filename, groupname, | 62 String formatMessage(filename, groupname, |
63 [ testname = '', testTime = '', result = '', | 63 [ testname = '', testTime = '', result = '', |
64 message = '', stack = '' ]) { | 64 message = '', stack = '' ]) { |
65 var format = errorFormat; | 65 var format = errorFormat; |
66 if (result == 'pass') format = passFormat; | 66 if (result == 'pass') format = passFormat; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 var msg = formatListMessage('$testfile ', '$groupName ', '$testName '); | 184 var msg = formatListMessage('$testfile ', '$groupName ', '$testName '); |
185 print('$marker$msg'); | 185 print('$marker$msg'); |
186 } | 186 } |
187 if (notifyDone != null) { | 187 if (notifyDone != null) { |
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 Configuration { | 194 class TestRunnerChildConfiguration extends SimpleConfiguration { |
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 onSummary(int passed, int failed, int errors, | 198 void onSummary(int passed, int failed, int errors, |
199 List<TestCase> results, String uncaughtError) { | 199 List<TestCase> results, String uncaughtError) { |
200 TestCase test = results[0]; | 200 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.toString()]); | 202 test.message, test.stackTrace.toString()]); |
203 } | 203 } |
204 } | 204 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 process(testMain, action) { | 262 process(testMain, action) { |
263 groupSep = marker; | 263 groupSep = marker; |
264 unittestConfiguration = new TestRunnerConfiguration(); | 264 unittestConfiguration = new TestRunnerConfiguration(); |
265 group('', testMain); | 265 group('', testMain); |
266 // Do any user-specified test filtering. | 266 // Do any user-specified test filtering. |
267 filterTests(filterTest); | 267 filterTests(filterTest); |
268 action(); | 268 action(); |
269 } | 269 } |
OLD | NEW |