@@ -21,12 +21,6 @@ class PrintingTest {
2121 val testsDir = " tests/printing"
2222 val options = List (" -Xprint:typer" , " -color:never" , " -classpath" , TestConfiguration .basicClasspath)
2323
24- private def fileContent (filePath : String ): List [String ] =
25- if (new File (filePath).exists)
26- Source .fromFile(filePath, " UTF-8" ).getLines().toList
27- else Nil
28-
29-
3024 private def compileFile (path : JPath ): Boolean = {
3125 val baseFilePath = path.toString.stripSuffix(" .scala" )
3226 val checkFilePath = baseFilePath + " .check"
@@ -42,8 +36,20 @@ class PrintingTest {
4236 }
4337
4438 val actualLines = byteStream.toString(" UTF-8" ).split(" \\ r?\\ n" )
45-
46- FileDiff .checkAndDump(path.toString, actualLines.toIndexedSeq, checkFilePath)
39+ // 'options' includes option '-Xprint:typer' so the first output line
40+ // looks similar to "result of tests/printing/i620.scala after typer:";
41+ // check files use slashes as file separators (Unix) but running tests
42+ // on Windows produces backslashes.
43+ // NB. option '-Xprint:<..>' can specify several phases.
44+ val filteredLines =
45+ if (config.Properties .isWin)
46+ actualLines.map(line =>
47+ if (line.startsWith(" result of" )) line.replaceAll(" \\\\ " , " /" ) else line
48+ )
49+ else
50+ actualLines
51+
52+ FileDiff .checkAndDump(path.toString, filteredLines.toIndexedSeq, checkFilePath)
4753 }
4854
4955 @ Test
0 commit comments