| 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 /** | 5 /** |
| 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub | 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub |
| 7 * tests are integration tests that stage some stuff on the file system, run | 7 * tests are integration tests that stage some stuff on the file system, run |
| 8 * pub, and then validate the results. This library provides an API to build | 8 * pub, and then validate the results. This library provides an API to build |
| 9 * tests like that. | 9 * tests like that. |
| 10 */ | 10 */ |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 "waiting for process $name to exit").transform((exitCode) { | 1461 "waiting for process $name to exit").transform((exitCode) { |
| 1462 if (expectedExitCode != null) { | 1462 if (expectedExitCode != null) { |
| 1463 expect(exitCode, equals(expectedExitCode)); | 1463 expect(exitCode, equals(expectedExitCode)); |
| 1464 } | 1464 } |
| 1465 }); | 1465 }); |
| 1466 }); | 1466 }); |
| 1467 } | 1467 } |
| 1468 | 1468 |
| 1469 /// Wraps [source] and ensures it gets eagerly drained. We do this to make | 1469 /// Wraps [source] and ensures it gets eagerly drained. We do this to make |
| 1470 /// sure a process will exit even if we don't care about its output. | 1470 /// sure a process will exit even if we don't care about its output. |
| 1471 static Future<StringInputStream> _wrapStream(InputStream source) { | 1471 static StringInputStream _wrapStream(InputStream source) { |
| 1472 return new StringInputStream(wrapInputStream(source)); | 1472 return new StringInputStream(wrapInputStream(source)); |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 /// Prints the remaining data in the process's stdout and stderr streams. | 1475 /// Prints the remaining data in the process's stdout and stderr streams. |
| 1476 /// Prints nothing if the straems are empty. | 1476 /// Prints nothing if the straems are empty. |
| 1477 Future _printStreams() { | 1477 Future _printStreams() { |
| 1478 Future printStream(String streamName, StringInputStream stream) { | 1478 Future printStream(String streamName, StringInputStream stream) { |
| 1479 return consumeStringInputStream(stream).transform((output) { | 1479 return consumeStringInputStream(stream).transform((output) { |
| 1480 if (output.isEmpty) return; | 1480 if (output.isEmpty) return; |
| 1481 | 1481 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 /// calling [completion] is unnecessary. | 1637 /// calling [completion] is unnecessary. |
| 1638 void expectLater(Future actual, matcher, {String reason, | 1638 void expectLater(Future actual, matcher, {String reason, |
| 1639 FailureHandler failureHandler, bool verbose: false}) { | 1639 FailureHandler failureHandler, bool verbose: false}) { |
| 1640 _schedule((_) { | 1640 _schedule((_) { |
| 1641 return actual.transform((value) { | 1641 return actual.transform((value) { |
| 1642 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1642 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
| 1643 verbose: false); | 1643 verbose: false); |
| 1644 }); | 1644 }); |
| 1645 }); | 1645 }); |
| 1646 } | 1646 } |
| OLD | NEW |