The expected values for all of the tests use just line feeds ("\n") for line separators. But the line separators are added by the PrintStream class, and on Windows it will use a carriage return and line feed ("\r\n") as the line separator by default. This makes all tests with at least one line of expected output fail.
A solution I've been using is to explicitly set the system line.separator property to "\n" before creating the new PrintStream for the output:
diff --git a/src/test/scala/org/arnoldc/ByteCodeExecutor.scala b/src/test/scala/org/arnoldc/ByteCodeExecutor.scala
index ef9aebf..d6dc5f2 100644
--- a/src/test/scala/org/arnoldc/ByteCodeExecutor.scala
+++ b/src/test/scala/org/arnoldc/ByteCodeExecutor.scala
@@ -9,6 +9,7 @@ class ByteCodeExecutor extends ClassLoader {
val outputRedirectionStream = new ByteArrayOutputStream()
+ System.setProperty("line.separator", "\n");
System.setOut(new PrintStream(outputRedirectionStream))
invokeMainMethod(bytecode, className)
The expected values for all of the tests use just line feeds ("\n") for line separators. But the line separators are added by the PrintStream class, and on Windows it will use a carriage return and line feed ("\r\n") as the line separator by default. This makes all tests with at least one line of expected output fail.
A solution I've been using is to explicitly set the system line.separator property to "\n" before creating the new PrintStream for the output: