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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 /// The port with which the child isolate should communicate with the parent | 126 /// The port with which the child isolate should communicate with the parent |
127 /// isolate. | 127 /// isolate. |
128 /// | 128 /// |
129 /// `null` in the parent isolate. | 129 /// `null` in the parent isolate. |
130 SendPort _replyTo; | 130 SendPort _replyTo; |
131 | 131 |
132 /// Whether or not we're running in a child isolate that's supposed to run a | 132 /// Whether or not we're running in a child isolate that's supposed to run a |
133 /// test. | 133 /// test. |
134 bool _inChildIsolate; | 134 bool _inChildIsolate; |
| 135 bool get inChildIsolate => _inChildIsolate; |
135 | 136 |
136 /// Initialize metatest. | 137 /// Initialize metatest. |
137 /// | 138 /// |
138 /// [message] should be the second argument to [main]. It's used to determine | 139 /// [message] should be the second argument to [main]. It's used to determine |
139 /// whether this test is in the parent isolate or a child isolate. | 140 /// whether this test is in the parent isolate or a child isolate. |
140 void initMetatest(message) { | 141 void initMetatest(message) { |
141 if (message == null) { | 142 if (message == null) { |
142 _inChildIsolate = false; | 143 _inChildIsolate = false; |
143 } else { | 144 } else { |
144 _testToRun = message['testToRun']; | 145 _testToRun = message['testToRun']; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 "uncaughtError": uncaughtError, | 232 "uncaughtError": uncaughtError, |
232 "results": results.map((testCase) => { | 233 "results": results.map((testCase) => { |
233 "description": testCase.description, | 234 "description": testCase.description, |
234 "message": testCase.message, | 235 "message": testCase.message, |
235 "result": testCase.result, | 236 "result": testCase.result, |
236 "stackTrace": testCase.stackTrace.toString() | 237 "stackTrace": testCase.stackTrace.toString() |
237 }).toList() | 238 }).toList() |
238 }); | 239 }); |
239 } | 240 } |
240 } | 241 } |
OLD | NEW |