Index: tests/standalone/src/ProcessStderrTest.dart |
diff --git a/tests/standalone/src/ProcessStderrTest.dart b/tests/standalone/src/ProcessStderrTest.dart |
index 7c090dc42d6c5bd2b0143628e87343ecf5238567..ac0b0d7b7385fba950efefa54da2ba1c27528ff7 100644 |
--- a/tests/standalone/src/ProcessStderrTest.dart |
+++ b/tests/standalone/src/ProcessStderrTest.dart |
@@ -9,9 +9,12 @@ |
// VMOptions=--short_socket_write |
// VMOptions=--short_socket_read --short_socket_write |
+#source("ProcessTestUtil.dart"); |
+ |
class ProcessStderrTest { |
- static void testStderr() { |
- Process process = new Process("out/Debug_ia32/process_test", |
+ |
+ static void testExit() { |
+ Process process = new Process(getProcessTestFileName(), |
const ["1", "1", "99", "0"]); |
final int BUFFERSIZE = 10; |
final int STARTCHAR = 65; |
@@ -27,18 +30,30 @@ class ProcessStderrTest { |
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) - 1; i++) { |
+ Expect.equals(data[i], buffer[i]); |
+ } |
+ 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(13, buffer[BUFFERSIZE - 1]); |
+ Expect.equals(10, buffer[BUFFERSIZE]); |
+ buffer.removeLast(); |
+ process.close(); |
+ } else if (received == BUFFERSIZE) { |
+ Expect.equals(10, buffer[BUFFERSIZE - 1]); |
+ process.close(); |
+ } |
} |
- received += buffer.length; |
} |
void streamClosed() { |
Expect.equals(BUFFERSIZE, received); |
- process.close(); |
} |
output.write(data); |
@@ -48,10 +63,10 @@ class ProcessStderrTest { |
} |
static void testMain() { |
- testStderr(); |
+ testExit(); |
} |
} |
main() { |
- ProcessStderrTest.testStderr(); |
+ ProcessStderrTest.testMain(); |
} |