From 9729d0a9387cd6266389eb8d52434f1799d01b9f Mon Sep 17 00:00:00 2001 From: Neeraj Jaiswal Date: Thu, 18 Oct 2018 00:35:58 +0530 Subject: [PATCH] Add check to verify output ends with a new line in REPL --- compiler/test/dotty/tools/repl/ScriptedTests.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/test/dotty/tools/repl/ScriptedTests.scala b/compiler/test/dotty/tools/repl/ScriptedTests.scala index 090d49949d08..7af576d7695d 100644 --- a/compiler/test/dotty/tools/repl/ScriptedTests.scala +++ b/compiler/test/dotty/tools/repl/ScriptedTests.scala @@ -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() @@ -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")