@@ -244,7 +244,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
244
244
245
245
final def countErrors (reporters : Seq [TestReporter ]) = countErrorsAndWarnings(reporters)._1
246
246
final def countWarnings (reporters : Seq [TestReporter ]) = countErrorsAndWarnings(reporters)._2
247
- final def reporterFailed (r : TestReporter ) = r.compilerCrashed || r. errorCount > 0
247
+ final def reporterFailed (r : TestReporter ) = r.errorCount > 0
248
248
249
249
/**
250
250
* For a given test source, returns a check file against which the result of the test run
@@ -733,22 +733,20 @@ 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
- if reporters.exists(_.compilerCrashed) then s " Compiler crashed when compiling: ${testSource.title}"
741
- else if reporters.exists(_.errorCount > 0 ) then
741
+ if reporters.exists(_.errorCount > 0 ) then
742
742
s """ Compilation failed for: ${testSource.title}
743
743
| $showDiagnostics
744
744
| """ .stripMargin.trim.linesIterator.mkString(" \n " , " \n " , " " )
745
- else if obtCount == 0 then s " \n No warnings found when compiling warn test $testSource"
746
- else if expCount == 0 then s " \n No warning expected/defined in $testSource -- use // warn "
747
745
else if expCount != obtCount then
748
746
s """ |Wrong number of warnings encountered when compiling $testSource
749
747
|expected: $expCount, actual: $obtCount
750
- | ${expected.mkString (" Unfulfilled expectations:\n " , " \n " , " " )}
751
- | ${unexpected.mkString (" Unexpected warnings:\n " , " \n " , " " )}
748
+ | ${showLines (" Unfulfilled expectations:" , expected )}
749
+ | ${showLines (" Unexpected warnings:" , unexpected )}
752
750
| $showDiagnostics
753
751
| """ .stripMargin.trim.linesIterator.mkString(" \n " , " \n " , " " )
754
752
else if hasMissingAnnotations then s " \n Warnings found on incorrect row numbers when compiling $testSource\n $showDiagnostics"
@@ -862,7 +860,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
862
860
override def suppressErrors = true
863
861
864
862
override def maybeFailureMessage (testSource : TestSource , reporters : Seq [TestReporter ]): Option [String ] =
865
- def compilerCrashed = reporters.exists(_.compilerCrashed)
866
863
lazy val (errorMap, expectedErrors) = getErrorMapAndExpectedCount(testSource.sourceFiles.toIndexedSeq)
867
864
lazy val actualErrors = reporters.foldLeft(0 )(_ + _.errorCount)
868
865
lazy val (expected, unexpected) = getMissingExpectedErrors(errorMap, reporters.iterator.flatMap(_.errors))
@@ -871,8 +868,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
871
868
reporters.flatMap(_.allErrors.sortBy(_.pos.line).map(e => s " ${e.pos.line + 1 }: ${e.message}" )).mkString(" at " , " \n at " , " " )
872
869
873
870
Option {
874
- if compilerCrashed then s " Compiler crashed when compiling: ${testSource.title}"
875
- else if actualErrors == 0 then s " \n No errors found when compiling neg test $testSource"
871
+ if actualErrors == 0 then s " \n No errors found when compiling neg test $testSource"
876
872
else if expectedErrors == 0 then s " \n No errors expected/defined in $testSource -- use // error or // nopos-error "
877
873
else if expectedErrors != actualErrors then
878
874
s """ |Wrong number of errors encountered when compiling $testSource
0 commit comments