Skip to content

Commit

Permalink
Vulpix: Skip empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Oct 17, 2023
1 parent b843332 commit 372e485
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
lazy val (map, expCount) = getWarnMapAndExpectedCount(testSource.sourceFiles.toIndexedSeq)
lazy val obtCount = reporters.foldLeft(0)(_ + _.warningCount)
lazy val (expected, unexpected) = getMissingExpectedWarnings(map, reporters.iterator.flatMap(_.diagnostics))
lazy val diagnostics = reporters.flatMap(_.diagnostics.toSeq.sortBy(_.pos.line).map(e => s" at ${e.pos.line + 1}: ${e.message}"))
def showLines(title: String, lines: Seq[String]) = if lines.isEmpty then "" else title + lines.mkString("\n", "\n", "")
def hasMissingAnnotations = expected.nonEmpty || unexpected.nonEmpty
def showDiagnostics = "-> following the diagnostics:\n" +
reporters.flatMap(_.diagnostics.toSeq.sortBy(_.pos.line).map(e => s"${e.pos.line + 1}: ${e.message}")).mkString(" at ", "\n at ", "")
def showDiagnostics = showLines("-> following the diagnostics:", diagnostics)
Option:
if reporters.exists(_.errorCount > 0) then
s"""Compilation failed for: ${testSource.title}
Expand All @@ -744,8 +745,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
else if expCount != obtCount then
s"""|Wrong number of warnings encountered when compiling $testSource
|expected: $expCount, actual: $obtCount
|${expected.mkString("Unfulfilled expectations:\n", "\n", "")}
|${unexpected.mkString("Unexpected warnings:\n", "\n", "")}
|${showLines("Unfulfilled expectations:", expected)}
|${showLines("Unexpected warnings:", unexpected)}
|$showDiagnostics
|""".stripMargin.trim.linesIterator.mkString("\n", "\n", "")
else if hasMissingAnnotations then s"\nWarnings found on incorrect row numbers when compiling $testSource\n$showDiagnostics"
Expand Down

0 comments on commit 372e485

Please sign in to comment.