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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub | 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub |
6 /// tests are integration tests that stage some stuff on the file system, run | 6 /// tests are integration tests that stage some stuff on the file system, run |
7 /// pub, and then validate the results. This library provides an API to build | 7 /// pub, and then validate the results. This library provides an API to build |
8 /// tests like that. | 8 /// tests like that. |
9 library test_pub; | 9 library test_pub; |
10 | 10 |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 _lastMatcher.matches(item.last, matchState); | 1177 _lastMatcher.matches(item.last, matchState); |
1178 } | 1178 } |
1179 | 1179 |
1180 Description describe(Description description) { | 1180 Description describe(Description description) { |
1181 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 1181 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
1182 } | 1182 } |
1183 } | 1183 } |
1184 | 1184 |
1185 /// The time (in milliseconds) to wait for scheduled events that could run | 1185 /// The time (in milliseconds) to wait for scheduled events that could run |
1186 /// forever. | 1186 /// forever. |
1187 const _SCHEDULE_TIMEOUT = 5000; | 1187 const _SCHEDULE_TIMEOUT = 10000; |
1188 | 1188 |
1189 /// A class representing a [Process] that is scheduled to run in the course of | 1189 /// A class representing a [Process] that is scheduled to run in the course of |
1190 /// the test. This class allows actions on the process to be scheduled | 1190 /// the test. This class allows actions on the process to be scheduled |
1191 /// synchronously. All operations on this class are scheduled. | 1191 /// synchronously. All operations on this class are scheduled. |
1192 /// | 1192 /// |
1193 /// Before running the test, either [shouldExit] or [kill] must be called on | 1193 /// Before running the test, either [shouldExit] or [kill] must be called on |
1194 /// this to ensure that the process terminates when expected. | 1194 /// this to ensure that the process terminates when expected. |
1195 /// | 1195 /// |
1196 /// If the test fails, this will automatically print out any remaining stdout | 1196 /// If the test fails, this will automatically print out any remaining stdout |
1197 /// and stderr from the process to aid debugging. | 1197 /// and stderr from the process to aid debugging. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 /// calling [completion] is unnecessary. | 1539 /// calling [completion] is unnecessary. |
1540 void expectLater(Future actual, matcher, {String reason, | 1540 void expectLater(Future actual, matcher, {String reason, |
1541 FailureHandler failureHandler, bool verbose: false}) { | 1541 FailureHandler failureHandler, bool verbose: false}) { |
1542 _schedule((_) { | 1542 _schedule((_) { |
1543 return actual.then((value) { | 1543 return actual.then((value) { |
1544 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1544 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
1545 verbose: false); | 1545 verbose: false); |
1546 }); | 1546 }); |
1547 }); | 1547 }); |
1548 } | 1548 } |
OLD | NEW |