@@ -783,29 +783,22 @@ trait ParallelTesting extends RunnerOrchestration { self =>
783783 }
784784 }
785785
786- if (compilerCrashed) {
787- echo(s " Compiler crashed when compiling: ${testSource.title}" )
788- failTestSource(testSource)
789- }
790- else if (expectedErrors != actualErrors) {
791- echo {
792- s " \n Wrong number of errors encountered when compiling $testSource, expected: $expectedErrors, actual: $actualErrors\n "
793- }
794- failTestSource(testSource)
795- }
796- else if (hasMissingAnnotations()) {
797- echo {
798- s " \n Errors found on incorrect row numbers when compiling $testSource"
799- }
800- failTestSource(testSource)
801- }
802- else if (! errorMap.isEmpty) {
803- echo {
804- s " \n Expected error(s) have {<error position>=<unreported error>}: $errorMap"
805- }
786+ def fail (msg : String ): Unit = {
787+ echo(msg)
806788 failTestSource(testSource)
807789 }
808790
791+ if (compilerCrashed)
792+ fail(s " Compiler crashed when compiling: ${testSource.title}" )
793+ else if (actualErrors == 0 )
794+ fail(s " \n No errors found when compiling neg test $testSource" )
795+ else if (expectedErrors != actualErrors)
796+ fail(s " \n Wrong number of errors encountered when compiling $testSource, expected: $expectedErrors, actual: $actualErrors" )
797+ else if (hasMissingAnnotations())
798+ fail(s " \n Errors found on incorrect row numbers when compiling $testSource" )
799+ else if (! errorMap.isEmpty)
800+ fail(s " \n Expected error(s) have {<error position>=<unreported error>}: $errorMap" )
801+
809802 registerCompletion(actualErrors)
810803 }
811804 }
0 commit comments