@@ -48,7 +48,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
4848 /** A test source whose files or directory of files is to be compiled
4949 * in a specific way defined by the `Test`
5050 */
51- protected sealed trait TestSource { self =>
51+ private sealed trait TestSource { self =>
5252 def name : String
5353 def outDir : JFile
5454 def flags : TestFlags
@@ -602,20 +602,39 @@ trait ParallelTesting extends RunnerOrchestration { self =>
602602 if (Properties .testsNoRun) addNoRunWarning()
603603 else runMain(testSource.runClassPath) match {
604604 case Success (_) if ! checkFile.isDefined || ! checkFile.get.exists => // success!
605- case Success (output) =>
606- checkDiff(output, checkFile.get, testSource, warnings) match {
607- case Some (msg) =>
608- echo(msg)
609- addFailureInstruction(msg)
610-
611- // Print build instructions to file and summary:
612- val buildInstr = testSource.buildInstructions(0 , warnings)
613- addFailureInstruction(buildInstr)
614-
615- // Fail target:
616- failTestSource(testSource)
617- case None =>
605+ case Success (output) => {
606+ val outputLines = output.lines.toArray :+ DiffUtil .EOF
607+ val checkLines : Array [String ] = Source .fromFile(checkFile.get).getLines().toArray :+ DiffUtil .EOF
608+ val sourceTitle = testSource.title
609+
610+ def linesMatch =
611+ outputLines
612+ .zip(checkLines)
613+ .forall { case (x, y) => x == y }
614+
615+ if (outputLines.length != checkLines.length || ! linesMatch) {
616+ // Print diff to files and summary:
617+ val expectedSize = DiffUtil .EOF .length max checkLines.map(_.length).max
618+ val diff = outputLines.padTo(checkLines.length, " " ).zip(checkLines.padTo(outputLines.length, " " )).map { case (act, exp) =>
619+ DiffUtil .mkColoredLineDiff(exp, act, expectedSize)
620+ }.mkString(" \n " )
621+
622+ val msg =
623+ s """ |Output from ' $sourceTitle' did not match check file.
624+ |Diff (expected on the left, actual right):
625+ | """ .stripMargin + diff + " \n "
626+ echo(msg)
627+ addFailureInstruction(msg)
628+
629+ // Print build instructions to file and summary:
630+ val buildInstr = testSource.buildInstructions(0 , warnings)
631+ addFailureInstruction(buildInstr)
632+
633+ // Fail target:
634+ failTestSource(testSource)
618635 }
636+ }
637+
619638 case Failure (output) =>
620639 echo(s " Test ' ${testSource.title}' failed with output: " )
621640 echo(output)
@@ -793,31 +812,6 @@ trait ParallelTesting extends RunnerOrchestration { self =>
793812 }
794813 }
795814
796- private def checkDiff (output : String , checkFile : JFile , testSource : TestSource , warnings : Int ): Option [String ] = {
797- val outputLines = output.lines.toArray :+ DiffUtil .EOF
798- val checkLines : Array [String ] = Source .fromFile(checkFile).getLines().toArray :+ DiffUtil .EOF
799- val sourceTitle = testSource.title
800-
801- def linesMatch =
802- outputLines
803- .zip(checkLines)
804- .forall { case (x, y) => x == y }
805-
806- if (outputLines.length != checkLines.length || ! linesMatch) {
807- // Print diff to files and summary:
808- val expectedSize = DiffUtil .EOF .length max checkLines.map(_.length).max
809- val diff = outputLines.padTo(checkLines.length, " " ).zip(checkLines.padTo(outputLines.length, " " )).map { case (act, exp) =>
810- DiffUtil .mkColoredLineDiff(exp, act, expectedSize)
811- }.mkString(" \n " )
812-
813- val msg =
814- s """ |Output from ' $sourceTitle' did not match check file.
815- |Diff (expected on the left, actual right):
816- | """ .stripMargin + diff + " \n "
817- Some (msg)
818- } else None
819- }
820-
821815 /** The `CompilationTest` is the main interface to `ParallelTesting`, it
822816 * can be instantiated via one of the following methods:
823817 *
0 commit comments