OLD | NEW |
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:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'package:path/path.dart'; | 6 import 'package:path/path.dart'; |
7 import "dart:io"; | 7 import "dart:io"; |
8 | 8 |
9 test(int blockCount, | 9 test(int blockCount, |
10 int stdoutBlockSize, | 10 int stdoutBlockSize, |
11 int stderrBlockSize, | 11 int stderrBlockSize, |
12 int exitCode, | 12 int exitCode, |
13 [int nonWindowsExitCode]) { | 13 [int nonWindowsExitCode]) { |
14 // Get the Dart script file that generates output. | 14 // Get the Dart script file that generates output. |
15 var scriptFile = new File(Platform.script | 15 var scriptFile = new File(join(dirname(Platform.script), |
16 .resolve("process_sync_script.dart") | 16 "process_sync_script.dart")); |
17 .toFilePath()); | |
18 var args = [scriptFile.path, | 17 var args = [scriptFile.path, |
19 blockCount.toString(), | 18 blockCount.toString(), |
20 stdoutBlockSize.toString(), | 19 stdoutBlockSize.toString(), |
21 stderrBlockSize.toString(), | 20 stderrBlockSize.toString(), |
22 exitCode.toString()]; | 21 exitCode.toString()]; |
23 ProcessResult syncResult = Process.runSync(Platform.executable, args); | 22 ProcessResult syncResult = Process.runSync(Platform.executable, args); |
24 Expect.equals(blockCount * stdoutBlockSize, syncResult.stdout.length); | 23 Expect.equals(blockCount * stdoutBlockSize, syncResult.stdout.length); |
25 Expect.equals(blockCount * stderrBlockSize, syncResult.stderr.length); | 24 Expect.equals(blockCount * stderrBlockSize, syncResult.stderr.length); |
26 if (Platform.isWindows) { | 25 if (Platform.isWindows) { |
27 Expect.equals(exitCode, syncResult.exitCode); | 26 Expect.equals(exitCode, syncResult.exitCode); |
(...skipping 25 matching lines...) Expand all Loading... |
53 test(1, kBufferSize, kBufferSize, 0); | 52 test(1, kBufferSize, kBufferSize, 0); |
54 test(1, kBufferSize - 1, kBufferSize - 1, 0); | 53 test(1, kBufferSize - 1, kBufferSize - 1, 0); |
55 test(1, kBufferSize + 1, kBufferSize + 1, 0); | 54 test(1, kBufferSize + 1, kBufferSize + 1, 0); |
56 | 55 |
57 test(10, 10, 10, 1); | 56 test(10, 10, 10, 1); |
58 test(10, 10, 10, 255); | 57 test(10, 10, 10, 255); |
59 test(10, 10, 10, -1, 255); | 58 test(10, 10, 10, -1, 255); |
60 test(10, 10, 10, -255, 1); | 59 test(10, 10, 10, -255, 1); |
61 } | 60 } |
62 | 61 |
OLD | NEW |