@@ -733,9 +733,10 @@ trait ParallelTesting extends RunnerOrchestration { self =>
733
733
lazy val (map, expCount) = getWarnMapAndExpectedCount(testSource.sourceFiles.toIndexedSeq)
734
734
lazy val obtCount = reporters.foldLeft(0 )(_ + _.warningCount)
735
735
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 " , " " )
736
738
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)
739
740
Option :
740
741
if reporters.exists(_.errorCount > 0 ) then
741
742
s """ Compilation failed for: ${testSource.title}
@@ -744,8 +745,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
744
745
else if expCount != obtCount then
745
746
s """ |Wrong number of warnings encountered when compiling $testSource
746
747
|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 )}
749
750
| $showDiagnostics
750
751
| """ .stripMargin.trim.linesIterator.mkString(" \n " , " \n " , " " )
751
752
else if hasMissingAnnotations then s " \n Warnings found on incorrect row numbers when compiling $testSource\n $showDiagnostics"
0 commit comments