| 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 // Process working directory test. | 5 // Process working directory test. |
| 6 | 6 |
| 7 library ProcessWorkingDirectoryTest; | 7 library ProcessWorkingDirectoryTest; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 import "process_test_util.dart"; | 9 import "process_test_util.dart"; |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 directory.deleteSync(); | 35 directory.deleteSync(); |
| 36 Expect.fail("Couldn't start process"); | 36 Expect.fail("Couldn't start process"); |
| 37 }); | 37 }); |
| 38 } | 38 } |
| 39 | 39 |
| 40 static void testInvalidDirectory() { | 40 static void testInvalidDirectory() { |
| 41 Directory directory = new Directory("").createTempSync(); | 41 Directory directory = new Directory("").createTempSync(); |
| 42 Expect.isTrue(directory.existsSync()); | 42 Expect.isTrue(directory.existsSync()); |
| 43 | 43 |
| 44 var options = new ProcessOptions(); | 44 var options = new ProcessOptions(); |
| 45 options.workingDirectory = directory.path.concat("/subPath"); | 45 options.workingDirectory = directory.path + "/subPath"; |
| 46 var future = Process.start(fullTestFilePath, | 46 var future = Process.start(fullTestFilePath, |
| 47 const ["0", "0", "99", "0"], | 47 const ["0", "0", "99", "0"], |
| 48 options); | 48 options); |
| 49 future.then((process) { | 49 future.then((process) { |
| 50 Expect.fail("bad process completed"); | 50 Expect.fail("bad process completed"); |
| 51 directory.deleteSync(); | 51 directory.deleteSync(); |
| 52 }).catchError((e) { | 52 }).catchError((e) { |
| 53 Expect.isNotNull(e); | 53 Expect.isNotNull(e); |
| 54 directory.deleteSync(); | 54 directory.deleteSync(); |
| 55 }); | 55 }); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 | 60 |
| 61 main() { | 61 main() { |
| 62 ProcessWorkingDirectoryTest.testValidDirectory(); | 62 ProcessWorkingDirectoryTest.testValidDirectory(); |
| 63 ProcessWorkingDirectoryTest.testInvalidDirectory(); | 63 ProcessWorkingDirectoryTest.testInvalidDirectory(); |
| 64 } | 64 } |
| OLD | NEW |