@@ -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
}
@@ -937,17 +937,28 @@ trait ParallelTesting extends RunnerOrchestration { self =>
937
937
938
938
/** Tests `-rewrite`, which makes sure that the rewritten files still compile
939
939
* and agree with the expected result (if specified).
940
+ *
941
+ * Check files are only supported for joint compilation sources.
940
942
*/
941
943
def checkRewrites ()(implicit summaryReport : SummaryReporting ): this .type = {
944
+ // use the original check file, to simplify update of check files
945
+ var checkFileMap = Map .empty[JFile , JFile ]
946
+
942
947
// copy source file to targets, as they will be changed
943
948
val copiedTargets = targets.map {
944
949
case target @ JointCompilationSource (_, files, _, outDir, _, _) =>
945
- target.copy(files = files.map(copyToDir(outDir,_)))
950
+ val files2 = files.map { f =>
951
+ val dest = copyToDir(outDir, f)
952
+ val checkFile = new JFile (f.getPath.replaceFirst(" \\ .scala$" , " .check" ))
953
+ if (checkFile.exists) checkFileMap = checkFileMap.updated(dest, checkFile)
954
+ dest
955
+ }
956
+ target.copy(files = files2)
946
957
case target @ SeparateCompilationSource (_, dir, _, outDir) =>
947
958
target.copy(dir = copyToDir(outDir, dir))
948
959
}
949
960
950
- val test = new RewriteTest (copiedTargets, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
961
+ val test = new RewriteTest (copiedTargets, checkFileMap, times, threadLimit, shouldFail || shouldSuppressOutput).executeTestSuite()
951
962
this
952
963
}
953
964
0 commit comments