Skip to content

Fix #5158: Take into account Windows line endings #5159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/test/dotty/tools/repl/ReplCompilerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ReplCompilerTests extends ReplTest {
"val res1: Int = 20"
)

assertEquals(expected, storedOutput().split("\n").toList)
assertEquals(expected, lines())
}

@Test def testImportMutable =
Expand Down Expand Up @@ -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

}
6 changes: 3 additions & 3 deletions compiler/test/dotty/tools/repl/ScriptedTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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) {
Expand Down