Chromium Code Reviews| Index: tests/standalone/io/process_shell_test.dart |
| diff --git a/tests/standalone/io/process_shell_test.dart b/tests/standalone/io/process_shell_test.dart |
| index add0c9fca7ca8cee3b536b465617dcd63f432ca2..3980eac9190ac0bc306ecad0dc3320cfbf029395 100644 |
| --- a/tests/standalone/io/process_shell_test.dart |
| +++ b/tests/standalone/io/process_shell_test.dart |
| @@ -3,13 +3,16 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| import "dart:io"; |
| +import "dart:isolate"; |
| void testRunShell() { |
| test(args) { |
| var options = new Options(); |
| var path = new Path(options.script); |
| path = path.directoryPath.join(new Path("process_echo_util.dart")); |
| - Process.runShell(options.executable, [path.toString()]..addAll(args)) |
| + Process.run(options.executable, |
| + [path.toString()]..addAll(args), |
| + runInShell: true) |
| .then((result) { |
| if (Platform.operatingSystem == "windows") { |
| result = result.stdout.split("\r\n"); |
| @@ -29,44 +32,35 @@ void testRunShell() { |
| test(["\""]); |
| test(["a b"]); |
| test(["'"]); |
| + test(["'", "'"]); |
| test(["'\"\"'\"'\"'"]); |
| test(["'\"\"'", "\"'\"'"]); |
| + test(["'\\\"\\\"'\\", "\"\\'\"'"]); |
| test(["'\$HOME'"]); |
| test(["'\$tmp'"]); |
| + test(["arg'"]); |
| + test(["arg\\'", "'\\arg"]); |
| } |
| -void testShell() { |
| - test(args, expected) { |
| +void testBadRunShell() { |
|
Bill Hesse
2013/07/22 15:36:29
This change to testBadRunShell seems totally broke
Anders Johnsen
2013/07/22 15:44:22
It's supposed to test that you can't run the progr
Bill Hesse
2013/07/22 15:50:22
OK, so it has nothing to do with the testShell() f
|
| + test(exe, [args = const []]) { |
| var options = new Options(); |
| var path = new Path(options.script); |
| path = path.directoryPath.join(new Path("process_echo_util.dart")); |
| - var command = "${options.executable} $path $args"; |
| - Process.runShell(command, []) |
| + Process.run(exe, args, runInShell: true) |
| .then((result) { |
| - if (Platform.operatingSystem == "windows") { |
| - result = result.stdout.split("\r\n"); |
| - } else { |
| - result = result.stdout.split("\n"); |
| - } |
| - if (result.length - 1 != expected.length) { |
| - throw "wrong number of args: $expected vs $result"; |
| - } |
| - for (int i = 0; i < expected.length; i++) { |
| - if (expected[i] != result[i]) { |
| - throw "bad result at $i: ${expected[i]} vs ${result[i]}"; |
| - } |
| + port.close(); |
| + if (result.exitCode == 0) { |
| + throw "error expected"; |
| } |
| }); |
| } |
| - test("arg", ["arg"]); |
| - test("arg1 arg2", ["arg1", "arg2"]); |
| - if (Platform.operatingSystem != 'windows') { |
| - test("arg1 arg2 > /dev/null", []); |
| - } |
| + test("\""); |
| + test("'\$HOME'"); |
| } |
| void main() { |
| testRunShell(); |
| - testShell(); |
| + testBadRunShell(); |
| } |