Skip to content

Commit 3cee254

Browse files
dwijnandWojciechMazur
authored andcommitted
Vulpix: Skip empty lines
[Cherry-picked 372e485]
1 parent 1877e64 commit 3cee254

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
733733
lazy val (map, expCount) = getWarnMapAndExpectedCount(testSource.sourceFiles.toIndexedSeq)
734734
lazy val obtCount = reporters.foldLeft(0)(_ + _.warningCount)
735735
lazy val (expected, unexpected) = getMissingExpectedWarnings(map, reporters.iterator.flatMap(_.diagnostics))
736+
lazy val diagnostics = reporters.flatMap(_.diagnostics.toSeq.sortBy(_.pos.line).map(e => s" at ${e.pos.line + 1}: ${e.message}"))
737+
def showLines(title: String, lines: Seq[String]) = if lines.isEmpty then "" else title + lines.mkString("\n", "\n", "")
736738
def hasMissingAnnotations = expected.nonEmpty || unexpected.nonEmpty
737-
def showDiagnostics = "-> following the diagnostics:\n" +
738-
reporters.flatMap(_.diagnostics.toSeq.sortBy(_.pos.line).map(e => s"${e.pos.line + 1}: ${e.message}")).mkString(" at ", "\n at ", "")
739+
def showDiagnostics = showLines("-> following the diagnostics:", diagnostics)
739740
Option:
740741
if reporters.exists(_.errorCount > 0) then
741742
s"""Compilation failed for: ${testSource.title}
@@ -744,8 +745,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
744745
else if expCount != obtCount then
745746
s"""|Wrong number of warnings encountered when compiling $testSource
746747
|expected: $expCount, actual: $obtCount
747-
|${expected.mkString("Unfulfilled expectations:\n", "\n", "")}
748-
|${unexpected.mkString("Unexpected warnings:\n", "\n", "")}
748+
|${showLines("Unfulfilled expectations:", expected)}
749+
|${showLines("Unexpected warnings:", unexpected)}
749750
|$showDiagnostics
750751
|""".stripMargin.trim.linesIterator.mkString("\n", "\n", "")
751752
else if hasMissingAnnotations then s"\nWarnings found on incorrect row numbers when compiling $testSource\n$showDiagnostics"

0 commit comments

Comments
 (0)