Chromium Code Reviews| Index: tests/standalone/io/dart_std_io_pipe_test.dart |
| diff --git a/tests/standalone/io/dart_std_io_pipe_test.dart b/tests/standalone/io/dart_std_io_pipe_test.dart |
| index 95019e5b535a65e24cda81d1fdc0a7ee5d86adbe..50c7a4616b7db9c7dbccf25c1510465a19288e0d 100644 |
| --- a/tests/standalone/io/dart_std_io_pipe_test.dart |
| +++ b/tests/standalone/io/dart_std_io_pipe_test.dart |
| @@ -40,39 +40,38 @@ void test(String shellScript, String dartScript, String type) { |
| String executable = new Options().executable; |
| List args = |
| [executable, dartScript, type, pipeOutFile, redirectOutFile]; |
| - Process process = Process.start(shellScript, args); |
| + var future = Process.start(shellScript, args); |
| + future.then((process) { |
| + process.onExit = (exitCode) { |
| + Expect.equals(0, exitCode); |
| + process.close(); |
| - // Wait for the process to exit and then check result. |
| - process.onExit = (exitCode) { |
| - Expect.equals(0, exitCode); |
| - process.close(); |
| + // Check the expected file contents. |
| + if (type == "0") { |
| + checkFileContent("${pipeOutFile}", "Hello\n"); |
| + checkFileEmpty("${redirectOutFile}.stderr"); |
| + checkFileContent("${redirectOutFile}.stdout", "Hello\nHello\n"); |
| + } |
| + if (type == "1") { |
| + checkFileContent("${pipeOutFile}", "Hello\n"); |
| + checkFileEmpty("${redirectOutFile}.stdout"); |
| + checkFileContent("${redirectOutFile}.stderr", "Hello\nHello\n"); |
| + } |
| + if (type == "2") { |
| + checkFileContent("${pipeOutFile}", "Hello\nHello\n"); |
| + checkFileContent("${redirectOutFile}.stdout", |
| + "Hello\nHello\nHello\nHello\n"); |
| + checkFileContent("${redirectOutFile}.stderr", |
| + "Hello\nHello\nHello\nHello\n"); |
| + } |
| - // Check the expected file contents. |
| - if (type == "0") { |
| - checkFileContent("${pipeOutFile}", "Hello\n"); |
| - checkFileEmpty("${redirectOutFile}.stderr"); |
| - checkFileContent("${redirectOutFile}.stdout", "Hello\nHello\n"); |
| - } |
| - if (type == "1") { |
| - checkFileContent("${pipeOutFile}", "Hello\n"); |
| - checkFileEmpty("${redirectOutFile}.stdout"); |
| - checkFileContent("${redirectOutFile}.stderr", "Hello\nHello\n"); |
| - } |
| - if (type == "2") { |
| - checkFileContent("${pipeOutFile}", "Hello\nHello\n"); |
| - checkFileContent("${redirectOutFile}.stdout", |
| - "Hello\nHello\nHello\nHello\n"); |
| - checkFileContent("${redirectOutFile}.stderr", |
| - "Hello\nHello\nHello\nHello\n"); |
| - } |
| - |
| - // Cleanup test directory. |
| - dir.deleteRecursivelySync(); |
| - }; |
| - |
| - process.onError = (ProcessException error) { |
| + // Cleanup test directory. |
| + dir.deleteRecursivelySync(); |
| + }; |
| + }); |
| + future.handleException((ProcessException error) { |
| Expect.fail(error.toString()); |
|
ricow1
2012/10/11 17:27:34
we should probably do a dir.deleteRecursivelySync(
Mads Ager (google)
2012/10/12 08:44:46
Done for this particular test. I'm pretty sure tha
|
| - }; |
| + }); |
| } |
| // This tests that the Dart standalone VM can handle piping to stdin |