Skip to content

Add check to verify output ends with a new line in REPL scripted tests #5283

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

Merged
merged 1 commit into from
Jan 13, 2019
Merged
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
6 changes: 5 additions & 1 deletion compiler/test/dotty/tools/repl/ScriptedTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ScriptedTests extends ReplTest with MessageRendering {
val lines = Source.fromFile(f).getLines().buffered

assert(lines.head.startsWith(prompt),
s"""Each file has to start with the prompt: "$prompt"""")
s"""Each file has to start with the prompt: "$prompt"""")

def extractInputs(prompt: String): List[String] = {
val input = lines.next()
Expand Down Expand Up @@ -68,6 +68,10 @@ class ScriptedTests extends ReplTest with MessageRendering {
inputRes.foldLeft(initialState) { (state, input) =>
val (out, nstate) = evaluate(state, input, prompt)
buf.append(out)

assert(out.endsWith("\n"),
s"Expected output of $input to end with newline")

nstate
}
buf.flatMap(filterEmpties).mkString("\n")
Expand Down