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 #source("process_test_util.dart"); | 9 #source("process_test_util.dart"); |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 Expect.fail("error running process $error"); | 36 Expect.fail("error running process $error"); |
37 directory.deleteSync(); | 37 directory.deleteSync(); |
38 }; | 38 }; |
39 } | 39 } |
40 | 40 |
41 static void testInvalidDirectory() { | 41 static void testInvalidDirectory() { |
42 Directory directory = new Directory("").createTempSync(); | 42 Directory directory = new Directory("").createTempSync(); |
43 Expect.isTrue(directory.existsSync()); | 43 Expect.isTrue(directory.existsSync()); |
44 | 44 |
45 var options = new ProcessOptions(); | 45 var options = new ProcessOptions(); |
46 options.workingDirectory = directory.path + "/subPath"; | 46 options.workingDirectory = directory.path.concat("/subPath"); |
47 Process process = Process.start(fullTestFilePath, | 47 Process process = Process.start(fullTestFilePath, |
48 const ["0", "0", "99", "0"], | 48 const ["0", "0", "99", "0"], |
49 options); | 49 options); |
50 | 50 |
51 process.onExit = (int exitCode) { | 51 process.onExit = (int exitCode) { |
52 Expect.fail("bad process completed"); | 52 Expect.fail("bad process completed"); |
53 process.close(); | 53 process.close(); |
54 directory.deleteSync(); | 54 directory.deleteSync(); |
55 }; | 55 }; |
56 | 56 |
57 process.onError = (error) { | 57 process.onError = (error) { |
58 Expect.isNotNull(error); | 58 Expect.isNotNull(error); |
59 directory.deleteSync(); | 59 directory.deleteSync(); |
60 }; | 60 }; |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 | 65 |
66 main() { | 66 main() { |
67 ProcessWorkingDirectoryTest.testValidDirectory(); | 67 ProcessWorkingDirectoryTest.testValidDirectory(); |
68 ProcessWorkingDirectoryTest.testInvalidDirectory(); | 68 ProcessWorkingDirectoryTest.testInvalidDirectory(); |
69 } | 69 } |
OLD | NEW |