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 import "dart:io"; | 5 import "dart:io"; |
6 import "process_test_util.dart"; | 6 import "process_test_util.dart"; |
7 | 7 |
8 test(args) { | 8 test(args) { |
9 var future = Process.start(new Options().executable, args); | 9 var future = Process.start(new Options().executable, args); |
10 future.then((process) { | 10 future.then((process) { |
11 process.exitCode.then((exitCode) { | 11 process.exitCode.then((exitCode) { |
12 Expect.equals(0, exitCode); | 12 Expect.equals(0, exitCode); |
13 }); | 13 }); |
14 // Drain stdout and stderr. | 14 // Drain stdout and stderr. |
15 process.stdout.listen((_) {}); | 15 process.stdout.listen((_) {}); |
16 process.stderr.listen((_) {}); | 16 process.stderr.listen((_) {}); |
17 }); | 17 }); |
18 } | 18 } |
19 | 19 |
20 main() { | 20 main() { |
21 // Get the Dart script file which checks arguments. | 21 // Get the Dart script file which checks arguments. |
22 var scriptFile = | 22 var scriptFile = |
23 new File("tests/standalone/io/process_check_arguments_script.dart"); | 23 new File("tests/standalone/io/process_check_arguments_script.dart"); |
24 if (!scriptFile.existsSync()) { | 24 if (!scriptFile.existsSync()) { |
25 scriptFile = | 25 scriptFile = |
26 new File("../tests/standalone/io/process_check_arguments_script.dart"); | 26 new File("../tests/standalone/io/process_check_arguments_script.dart"); |
27 } | 27 } |
28 test([scriptFile.name, '3', '0', 'a']); | 28 test([scriptFile.path, '3', '0', 'a']); |
29 test([scriptFile.name, '3', '0', 'a b']); | 29 test([scriptFile.path, '3', '0', 'a b']); |
30 test([scriptFile.name, '3', '0', 'a\tb']); | 30 test([scriptFile.path, '3', '0', 'a\tb']); |
31 test([scriptFile.name, '3', '1', 'a\tb"']); | 31 test([scriptFile.path, '3', '1', 'a\tb"']); |
32 test([scriptFile.name, '3', '1', 'a"\tb']); | 32 test([scriptFile.path, '3', '1', 'a"\tb']); |
33 test([scriptFile.name, '3', '1', 'a"\t\\\\"b"']); | 33 test([scriptFile.path, '3', '1', 'a"\t\\\\"b"']); |
34 test([scriptFile.name, '4', '0', 'a\tb', 'a']); | 34 test([scriptFile.path, '4', '0', 'a\tb', 'a']); |
35 test([scriptFile.name, '4', '0', 'a\tb', 'a\t\t\t\tb']); | 35 test([scriptFile.path, '4', '0', 'a\tb', 'a\t\t\t\tb']); |
36 test([scriptFile.name, '4', '0', 'a\tb', 'a b']); | 36 test([scriptFile.path, '4', '0', 'a\tb', 'a b']); |
37 } | 37 } |
38 | 38 |
OLD | NEW |