Skip to content

Commit 9729d0a

Browse files
committed
Add check to verify output ends with a new line in REPL
1 parent ee1b514 commit 9729d0a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/test/dotty/tools/repl/ScriptedTests.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ScriptedTests extends ReplTest with MessageRendering {
2525
val lines = Source.fromFile(f).getLines().buffered
2626

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

3030
def extractInputs(prompt: String): List[String] = {
3131
val input = lines.next()
@@ -68,6 +68,10 @@ class ScriptedTests extends ReplTest with MessageRendering {
6868
inputRes.foldLeft(initialState) { (state, input) =>
6969
val (out, nstate) = evaluate(state, input, prompt)
7070
buf.append(out)
71+
72+
assert(out.endsWith("\n"),
73+
s"Expected output of $input to end with newline")
74+
7175
nstate
7276
}
7377
buf.flatMap(filterEmpties).mkString("\n")

0 commit comments

Comments
 (0)