| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #source("ProcessTestUtil.dart"); | 8 #source("ProcessTestUtil.dart"); |
| 9 | 9 |
| 10 class ProcessWorkingDirectoryTest { | 10 class ProcessWorkingDirectoryTest { |
| 11 static String get fullTestFilePath() { | 11 static String get fullTestFilePath() { |
| 12 // Extract full path, since we run processes from another directory. | 12 // Extract full path, since we run processes from another directory. |
| 13 File path = new File(getProcessTestFileName()); | 13 File path = new File(getProcessTestFileName()); |
| 14 Expect.isTrue(path.existsSync()); | 14 Expect.isTrue(path.existsSync()); |
| 15 return path.fullPathSync(); | 15 return path.fullPathSync(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 static void testValidDirectory() { | 18 static void testValidDirectory() { |
| 19 Directory directory = new Directory(""); | 19 Directory directory = new Directory(""); |
| 20 directory.createTempSync(); | 20 directory.createTempSync(); |
| 21 Expect.isTrue(directory.existsSync()); | 21 Expect.isTrue(directory.existsSync()); |
| 22 | 22 |
| 23 print(fullTestFilePath); | |
| 24 | |
| 25 Process process = new Process.start(fullTestFilePath, | 23 Process process = new Process.start(fullTestFilePath, |
| 26 const ["0", "0", "99", "0"], | 24 const ["0", "0", "99", "0"], |
| 27 directory.path); | 25 directory.path); |
| 28 | 26 |
| 29 process.exitHandler = (int exitCode) { | 27 process.exitHandler = (int exitCode) { |
| 30 Expect.equals(exitCode, 99); | 28 Expect.equals(exitCode, 99); |
| 31 process.close(); | 29 process.close(); |
| 32 directory.deleteSync(); | 30 directory.deleteSync(); |
| 33 }; | 31 }; |
| 34 | 32 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 59 }; | 57 }; |
| 60 } | 58 } |
| 61 } | 59 } |
| 62 | 60 |
| 63 | 61 |
| 64 | 62 |
| 65 main() { | 63 main() { |
| 66 ProcessWorkingDirectoryTest.testValidDirectory(); | 64 ProcessWorkingDirectoryTest.testValidDirectory(); |
| 67 ProcessWorkingDirectoryTest.testInvalidDirectory(); | 65 ProcessWorkingDirectoryTest.testInvalidDirectory(); |
| 68 } | 66 } |
| OLD | NEW |