@@ -21,12 +21,6 @@ class PrintingTest {
21
21
val testsDir = " tests/printing"
22
22
val options = List (" -Xprint:typer" , " -color:never" , " -classpath" , TestConfiguration .basicClasspath)
23
23
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
-
30
24
private def compileFile (path : JPath ): Boolean = {
31
25
val baseFilePath = path.toString.stripSuffix(" .scala" )
32
26
val checkFilePath = baseFilePath + " .check"
@@ -42,8 +36,20 @@ class PrintingTest {
42
36
}
43
37
44
38
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)
47
53
}
48
54
49
55
@ Test
0 commit comments