| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// A test library for testing test libraries? We must go deeper. | 5 /// A test library for testing test libraries? We must go deeper. |
| 6 /// | 6 /// |
| 7 /// Since unit testing code tends to use a lot of global state, it can be tough | 7 /// Since unit testing code tends to use a lot of global state, it can be tough |
| 8 /// to test. This library manages it by running each test case in a child | 8 /// to test. This library manages it by running each test case in a child |
| 9 /// isolate, then reporting the results back to the parent isolate. | 9 /// isolate, then reporting the results back to the parent isolate. |
| 10 library metatest; | 10 library metatest; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 /// Ensure that the metatest configuration is loaded. | 194 /// Ensure that the metatest configuration is loaded. |
| 195 void _ensureInitialized() { | 195 void _ensureInitialized() { |
| 196 unittestConfiguration = _singleton; | 196 unittestConfiguration = _singleton; |
| 197 } | 197 } |
| 198 | 198 |
| 199 final _singleton = new _MetaConfiguration(); | 199 final _singleton = new _MetaConfiguration(); |
| 200 | 200 |
| 201 /// Special test configuration for use within the child isolates. This hides all | 201 /// Special test configuration for use within the child isolates. This hides all |
| 202 /// output and reports data back to the parent isolate. | 202 /// output and reports data back to the parent isolate. |
| 203 class _MetaConfiguration extends SimpleConfiguration { | 203 class _MetaConfiguration extends Configuration { |
| 204 final name = "MetaConfiguration"; | |
| 205 | 204 |
| 206 void logTestCaseMesssage(TestCase testCase, String message) {} | 205 _MetaConfiguration() : super.blank(); |
| 207 | 206 |
| 208 void onSummary(int passed, int failed, int errors, List<TestCase> results, | 207 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 209 String uncaughtError) { | 208 String uncaughtError) { |
| 210 _replyTo.send({ | 209 _replyTo.send({ |
| 211 "passed": passed, | 210 "passed": passed, |
| 212 "failed": failed, | 211 "failed": failed, |
| 213 "errors": errors, | 212 "errors": errors, |
| 214 "uncaughtError": uncaughtError, | 213 "uncaughtError": uncaughtError, |
| 215 "results": results.map((testCase) => { | 214 "results": results.map((testCase) => { |
| 216 "description": testCase.description, | 215 "description": testCase.description, |
| 217 "message": testCase.message, | 216 "message": testCase.message, |
| 218 "result": testCase.result, | 217 "result": testCase.result, |
| 219 "stackTrace": testCase.stackTrace | 218 "stackTrace": testCase.stackTrace |
| 220 }).toList() | 219 }).toList() |
| 221 }); | 220 }); |
| 222 } | 221 } |
| 223 | |
| 224 void onInit() {} | |
| 225 void onDone(bool success) {} | |
| 226 } | 222 } |
| OLD | NEW |