Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: tests/standalone/io/process_shell_test.dart

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/platform_test.dart ('k') | tests/standalone/io/socket_close_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "package:path/path.dart"; 5 import "package:path/path.dart";
6 import "package:async_helper/async_helper.dart";
6 import "dart:io"; 7 import "dart:io";
8 import "dart:async";
7 import "dart:isolate"; 9 import "dart:isolate";
8 10
9 void testRunShell() { 11 void testRunShell() {
10 test(args) { 12 test(args) {
13 asyncStart();
11 var path = join(dirname(Platform.script), "process_echo_util.dart"); 14 var path = join(dirname(Platform.script), "process_echo_util.dart");
12 Process.run(Platform.executable, 15 Process.run(Platform.executable,
13 [path]..addAll(args), 16 [path]..addAll(args),
14 runInShell: true) 17 runInShell: true)
15 .then((result) { 18 .then((result) {
16 if (Platform.operatingSystem == "windows") { 19 if (Platform.operatingSystem == "windows") {
17 result = result.stdout.split("\r\n"); 20 result = result.stdout.split("\r\n");
18 } else { 21 } else {
19 result = result.stdout.split("\n"); 22 result = result.stdout.split("\n");
20 } 23 }
21 if (result.length - 1 != args.length) { 24 if (result.length - 1 != args.length) {
22 throw "wrong number of args: $args vs $result"; 25 throw "wrong number of args: $args vs $result";
23 } 26 }
24 for (int i = 0; i < args.length; i++) { 27 for (int i = 0; i < args.length; i++) {
25 if (args[i] != result[i]) { 28 if (args[i] != result[i]) {
26 throw "bad result at $i: '${args[i]}' vs '${result[i]}'"; 29 throw "bad result at $i: '${args[i]}' vs '${result[i]}'";
27 } 30 }
28 } 31 }
32 asyncEnd();
29 }); 33 });
30 } 34 }
31 test(["\""]); 35 test(["\""]);
32 test(["a b"]); 36 test(["a b"]);
33 test(["'"]); 37 test(["'"]);
34 test(["'", "'"]); 38 test(["'", "'"]);
35 test(["'\"\"'\"'\"'"]); 39 test(["'\"\"'\"'\"'"]);
36 test(["'\"\"'", "\"'\"'"]); 40 test(["'\"\"'", "\"'\"'"]);
37 test(["'\\\"\\\"'\\", "\"\\'\"'"]); 41 test(["'\\\"\\\"'\\", "\"\\'\"'"]);
38 test(["'\$HOME'"]); 42 test(["'\$HOME'"]);
39 test(["'\$tmp'"]); 43 test(["'\$tmp'"]);
40 test(["arg'"]); 44 test(["arg'"]);
41 test(["arg\\'", "'\\arg"]); 45 test(["arg\\'", "'\\arg"]);
42 } 46 }
43 47
44 void testBadRunShell() { 48 void testBadRunShell() {
45 test(exe, [args = const []]) { 49 test(exe, [args = const []]) {
50 asyncStart();
46 Process.run(exe, args, runInShell: true) 51 Process.run(exe, args, runInShell: true)
47 .then((result) { 52 .then((result) {
48 port.close();
49 if (result.exitCode == 0) { 53 if (result.exitCode == 0) {
50 throw "error expected"; 54 throw "error expected";
51 } 55 }
56 asyncEnd();
52 }); 57 });
53 } 58 }
54 test("'\"'"); 59 test("'\"'");
55 test("'\$HOME'"); 60 test("'\$HOME'");
56 } 61 }
57 62
58 void main() { 63 void main() {
59 testRunShell(); 64 testRunShell();
60 testBadRunShell(); 65 testBadRunShell();
61 } 66 }
62 67
OLDNEW
« no previous file with comments | « tests/standalone/io/platform_test.dart ('k') | tests/standalone/io/socket_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698