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

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

Issue 11343009: Get rid of 'close' on process. It is very easy to use incorrectly and cut off data from your stream… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 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
OLDNEW
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 #source("process_test_util.dart"); 6 #source("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.onExit = (exitCode) { 11 process.onExit = (exitCode) {
12 Expect.equals(0, exitCode); 12 Expect.equals(0, exitCode);
13 process.close();
14 }; 13 };
14 // Drain stdout and stderr.
15 process.stdout.onData = process.stdout.read;
16 process.stderr.onData = process.stderr.read;
15 }); 17 });
16 } 18 }
17 19
18 main() { 20 main() {
19 // Get the Dart script file which checks arguments. 21 // Get the Dart script file which checks arguments.
20 var scriptFile = 22 var scriptFile =
21 new File("tests/standalone/io/process_check_arguments_script.dart"); 23 new File("tests/standalone/io/process_check_arguments_script.dart");
22 if (!scriptFile.existsSync()) { 24 if (!scriptFile.existsSync()) {
23 scriptFile = 25 scriptFile =
24 new File("../tests/standalone/io/process_check_arguments_script.dart"); 26 new File("../tests/standalone/io/process_check_arguments_script.dart");
25 } 27 }
26 test([scriptFile.name, '3', '0', 'a']); 28 test([scriptFile.name, '3', '0', 'a']);
27 test([scriptFile.name, '3', '0', 'a b']); 29 test([scriptFile.name, '3', '0', 'a b']);
28 test([scriptFile.name, '3', '0', 'a\tb']); 30 test([scriptFile.name, '3', '0', 'a\tb']);
29 test([scriptFile.name, '3', '1', 'a\tb"']); 31 test([scriptFile.name, '3', '1', 'a\tb"']);
30 test([scriptFile.name, '3', '1', 'a"\tb']); 32 test([scriptFile.name, '3', '1', 'a"\tb']);
31 test([scriptFile.name, '3', '1', 'a"\t\\\\"b"']); 33 test([scriptFile.name, '3', '1', 'a"\t\\\\"b"']);
32 test([scriptFile.name, '4', '0', 'a\tb', 'a']); 34 test([scriptFile.name, '4', '0', 'a\tb', 'a']);
33 test([scriptFile.name, '4', '0', 'a\tb', 'a\t\t\t\tb']); 35 test([scriptFile.name, '4', '0', 'a\tb', 'a\t\t\t\tb']);
34 test([scriptFile.name, '4', '0', 'a\tb', 'a b']); 36 test([scriptFile.name, '4', '0', 'a\tb', 'a b']);
35 } 37 }
36 38
OLDNEW
« no previous file with comments | « tests/standalone/io/process_broken_pipe_test.dart ('k') | tests/standalone/io/process_exit_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698