Skip to content

Commit ce1086a

Browse files
authored
Merge pull request #5283 from nrjais/test-newline
Add check to verify output ends with a new line in REPL scripted tests
2 parents 971e89f + 9729d0a commit ce1086a

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
@@ -26,7 +26,7 @@ class ScriptedTests extends ReplTest with MessageRendering {
2626
val lines = Source.fromFile(f, "UTF-8").getLines().buffered
2727

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

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

0 commit comments

Comments
 (0)