@@ -582,12 +582,12 @@ trait ParallelTesting extends RunnerOrchestration { self =>
582
582
private final class PosTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
583
583
extends Test (testSources, times, threadLimit, suppressAllOutput)
584
584
585
- private final class RewriteTest (testSources : List [TestSource ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
585
+ private final class RewriteTest (testSources : List [TestSource ], checkFiles : Map [ JFile , JFile ], times : Int , threadLimit : Option [Int ], suppressAllOutput : Boolean )(implicit summaryReport : SummaryReporting )
586
586
extends Test (testSources, times, threadLimit, suppressAllOutput) {
587
587
private def verifyOutput (testSource : TestSource , reporters : Seq [TestReporter ], logger : LoggedRunnable ) = {
588
588
testSource.sourceFiles.foreach { file =>
589
- val checkFile = new JFile (file.getPath.replaceFirst( " \\ .scala$ " , " .check " ))
590
- if checkFile.exists then
589
+ if checkFiles.contains(file) then
590
+ val checkFile = checkFiles(file)
591
591
val actual = Source .fromFile(file, " UTF-8" ).getLines().toList
592
592
diffTest(testSource, checkFile, actual, reporters, logger)
593
593
}
@@ -935,17 +935,28 @@ trait ParallelTesting extends RunnerOrchestration { self =>
935
935
936
936
/** Tests `-rewrite`, which makes sure that the rewritten files still compile
937
937
* and agree with the expected result (if specified).
938
+ *
939
+ * Check files are only supported for joint compilation sources.
938
940
*/
939
941
def checkRewrites ()(implicit summaryReport : SummaryReporting ): this .type = {
942
+ // use the original check file, to simplify update of check files
943
+ var checkFileMap = Map .empty[JFile , JFile ]
944
+
940
945
// copy source file to targets, as they will be changed
941
946
val copiedTargets = targets.map {
942
947
case target @ JointCompilationSource (_, files, _, outDir, _, _) =>
943
- target.copy(files = files.map(copyToDir(outDir,_)))
948
+ val files2 = files.map { f =>
949
+ val dest = copyToDir(outDir, f)
950
+ val checkFile = new JFile (f.getPath.replaceFirst(" \\ .scala$" , " .check" ))
951
+ if (checkFile.exists) checkFileMap = checkFileMap.updated(dest, checkFile)
952
+ dest
953
+ }
954
+ target.copy(files = files2)
944
955
case target @ SeparateCompilationSource (_, dir, _, outDir) =>
945
956
target.copy(dir = copyToDir(outDir, dir))
946
957
}
947
958
948
- val test = new RewriteTest (copiedTargets, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
959
+ val test = new RewriteTest (copiedTargets, checkFileMap, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
949
960
this
950
961
}
951
962
0 commit comments