| 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 var process = _process.value; | 1417 var process = _process.value; |
| 1418 process.kill(); | 1418 process.kill(); |
| 1419 process.stdout.close(); | 1419 process.stdout.close(); |
| 1420 process.stderr.close(); | 1420 process.stderr.close(); |
| 1421 }); | 1421 }); |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 /// Reads the next line of stdout from the process. | 1424 /// Reads the next line of stdout from the process. |
| 1425 Future<String> nextLine() { | 1425 Future<String> nextLine() { |
| 1426 return _scheduleValue((_) { | 1426 return _scheduleValue((_) { |
| 1427 return timeout(_stdout.chain(readLine), _SCHEDULE_TIMEOUT, | 1427 return timeout(_stdout.chain((stream) => readLine(stream)), |
| 1428 _SCHEDULE_TIMEOUT, |
| 1428 "waiting for the next stdout line from process $name"); | 1429 "waiting for the next stdout line from process $name"); |
| 1429 }); | 1430 }); |
| 1430 } | 1431 } |
| 1431 | 1432 |
| 1432 /// Reads the next line of stderr from the process. | 1433 /// Reads the next line of stderr from the process. |
| 1433 Future<String> nextErrLine() { | 1434 Future<String> nextErrLine() { |
| 1434 return _scheduleValue((_) { | 1435 return _scheduleValue((_) { |
| 1435 return timeout(_stderr.chain(readLine), _SCHEDULE_TIMEOUT, | 1436 return timeout(_stderr.chain((stream) => readLine(stream)), |
| 1437 _SCHEDULE_TIMEOUT, |
| 1436 "waiting for the next stderr line from process $name"); | 1438 "waiting for the next stderr line from process $name"); |
| 1437 }); | 1439 }); |
| 1438 } | 1440 } |
| 1439 | 1441 |
| 1440 /// Reads the remaining stdout from the process. This should only be called | 1442 /// Reads the remaining stdout from the process. This should only be called |
| 1441 /// after kill() or shouldExit(). | 1443 /// after kill() or shouldExit(). |
| 1442 Future<String> remainingStdout() { | 1444 Future<String> remainingStdout() { |
| 1443 if (!_endScheduled) { | 1445 if (!_endScheduled) { |
| 1444 throw new StateError("remainingStdout() should only be called after " | 1446 throw new StateError("remainingStdout() should only be called after " |
| 1445 "kill() or shouldExit()."); | 1447 "kill() or shouldExit()."); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 /// calling [completion] is unnecessary. | 1666 /// calling [completion] is unnecessary. |
| 1665 void expectLater(Future actual, matcher, {String reason, | 1667 void expectLater(Future actual, matcher, {String reason, |
| 1666 FailureHandler failureHandler, bool verbose: false}) { | 1668 FailureHandler failureHandler, bool verbose: false}) { |
| 1667 _schedule((_) { | 1669 _schedule((_) { |
| 1668 return actual.transform((value) { | 1670 return actual.transform((value) { |
| 1669 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1671 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
| 1670 verbose: false); | 1672 verbose: false); |
| 1671 }); | 1673 }); |
| 1672 }); | 1674 }); |
| 1673 } | 1675 } |
| OLD | NEW |