| Index: tests/standalone/src/ProcessStdoutTest.dart
|
| diff --git a/tests/standalone/src/ProcessStdoutTest.dart b/tests/standalone/src/ProcessStdoutTest.dart
|
| index 644ea4f0ba47fab8e2aee2e14ea56f842f28ca83..418a6178e1f23f353721d2f12375c170895efec5 100644
|
| --- a/tests/standalone/src/ProcessStdoutTest.dart
|
| +++ b/tests/standalone/src/ProcessStdoutTest.dart
|
| @@ -9,11 +9,13 @@
|
| // VMOptions=--short_socket_write
|
| // VMOptions=--short_socket_read --short_socket_write
|
|
|
| +#source("ProcessTestUtil.dart");
|
| +
|
| class ProcessStdoutTest {
|
|
|
| - static void testStdout() {
|
| - Process process = new Process("out/Debug_ia32//process_test",
|
| - const ["0", "1", "99", "0"]);
|
| + static void testExit() {
|
| + Process process = new Process(getProcessTestFileName(),
|
| + const ["0", "1", "99", "0"]);
|
| final int BUFFERSIZE = 10;
|
| final int STARTCHAR = 65;
|
| List<int> data = new List<int>(BUFFERSIZE);
|
| @@ -28,15 +30,23 @@ class ProcessStdoutTest {
|
| process.start();
|
|
|
| int received = 0;
|
| + List<int> buffer = [];
|
|
|
| void readData() {
|
| - List<int> buffer = input.read();
|
| - for (int i = 0; i < buffer.length; i++) {
|
| - Expect.equals(data[received + i], buffer[i]);
|
| + buffer.addAll(input.read());
|
| + for (int i = received; i < Math.min(data.length, buffer.length); i++) {
|
| + Expect.equals(data[i], buffer[i]);
|
| }
|
| - received += buffer.length;
|
| - if (received == BUFFERSIZE) {
|
| - process.close();
|
| + received = buffer.length;
|
| + if (received >= BUFFERSIZE) {
|
| + // We expect an extra character on windows due to carriage return.
|
| + if (13 === buffer[BUFFERSIZE - 1] && BUFFERSIZE + 1 === received) {
|
| + Expect.equals(10, buffer[BUFFERSIZE]);
|
| + buffer.removeLast();
|
| + process.close();
|
| + } else if (received === BUFFERSIZE) {
|
| + process.close();
|
| + }
|
| }
|
| }
|
|
|
| @@ -51,7 +61,7 @@ class ProcessStdoutTest {
|
| }
|
|
|
| static void testMain() {
|
| - testStdout();
|
| + testExit();
|
| }
|
| }
|
|
|
|
|