diff --git a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala index efe6876c269b..7a748b3e29a6 100644 --- a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala +++ b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala @@ -51,7 +51,7 @@ class ReplCompilerTests extends ReplTest { "val res1: Int = 20" ) - assertEquals(expected, storedOutput().split("\n").toList) + assertEquals(expected, lines()) } @Test def testImportMutable = @@ -122,6 +122,9 @@ class ReplCompilerTests extends ReplTest { ) run(source) - assertEquals(expected, storedOutput().split("\n").toList) + assertEquals(expected, lines()) } + + private def lines() = storedOutput().trim().lines.toList + } diff --git a/compiler/test/dotty/tools/repl/ScriptedTests.scala b/compiler/test/dotty/tools/repl/ScriptedTests.scala index 090d49949d08..3936702e4499 100644 --- a/compiler/test/dotty/tools/repl/ScriptedTests.scala +++ b/compiler/test/dotty/tools/repl/ScriptedTests.scala @@ -44,7 +44,7 @@ class ScriptedTests extends ReplTest with MessageRendering { def evaluate(state: State, input: String, prompt: String) = try { val nstate = run(input.drop(prompt.length))(state) - val out = input + "\n" + storedOutput() + val out = (input :: storedOutput().trim().lines.toList).mkString(System.lineSeparator()) (out, nstate) } catch { @@ -60,7 +60,7 @@ class ScriptedTests extends ReplTest with MessageRendering { } val expectedOutput = - Source.fromFile(f).getLines().flatMap(filterEmpties).mkString("\n") + Source.fromFile(f).getLines().flatMap(filterEmpties).mkString(System.lineSeparator) val actualOutput = { resetToInitial() val inputRes = extractInputs(prompt) @@ -70,7 +70,7 @@ class ScriptedTests extends ReplTest with MessageRendering { buf.append(out) nstate } - buf.flatMap(filterEmpties).mkString("\n") + buf.flatMap(filterEmpties).mkString(System.lineSeparator) } if (expectedOutput != actualOutput) {