| 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 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 return timeout(_stderrFuture.then((stream) => stream.toList()) | 1423 return timeout(_stderrFuture.then((stream) => stream.toList()) |
| 1424 .then((lines) => lines.join("\n")), | 1424 .then((lines) => lines.join("\n")), |
| 1425 _SCHEDULE_TIMEOUT, | 1425 _SCHEDULE_TIMEOUT, |
| 1426 "waiting for the last stderr line from process $name"); | 1426 "waiting for the last stderr line from process $name"); |
| 1427 }); | 1427 }); |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 /// Writes [line] to the process as stdin. | 1430 /// Writes [line] to the process as stdin. |
| 1431 void writeLine(String line) { | 1431 void writeLine(String line) { |
| 1432 _schedule((_) => _processFuture.then( | 1432 _schedule((_) => _processFuture.then( |
| 1433 (p) => p.stdin.add('$line\n'.charCodes))); | 1433 (p) => p.stdin.add('$line\n'.codeUnits))); |
| 1434 } | 1434 } |
| 1435 | 1435 |
| 1436 /// Kills the process, and waits until it's dead. | 1436 /// Kills the process, and waits until it's dead. |
| 1437 void kill() { | 1437 void kill() { |
| 1438 _endScheduled = true; | 1438 _endScheduled = true; |
| 1439 _schedule((_) { | 1439 _schedule((_) { |
| 1440 _endExpected = true; | 1440 _endExpected = true; |
| 1441 _process.kill(); | 1441 _process.kill(); |
| 1442 timeout(_exitCodeFuture, _SCHEDULE_TIMEOUT, | 1442 timeout(_exitCodeFuture, _SCHEDULE_TIMEOUT, |
| 1443 "waiting for process $name to die"); | 1443 "waiting for process $name to die"); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 /// calling [completion] is unnecessary. | 1624 /// calling [completion] is unnecessary. |
| 1625 void expectLater(Future actual, matcher, {String reason, | 1625 void expectLater(Future actual, matcher, {String reason, |
| 1626 FailureHandler failureHandler, bool verbose: false}) { | 1626 FailureHandler failureHandler, bool verbose: false}) { |
| 1627 _schedule((_) { | 1627 _schedule((_) { |
| 1628 return actual.then((value) { | 1628 return actual.then((value) { |
| 1629 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1629 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
| 1630 verbose: false); | 1630 verbose: false); |
| 1631 }); | 1631 }); |
| 1632 }); | 1632 }); |
| 1633 } | 1633 } |
| OLD | NEW |