1- package dotty .tools
1+ package dotty
2+ package tools
23package dotc
34package reporting
45
5- import scala . language . unsafeNulls
6- import java .io .{ BufferedReader , FileInputStream , FileOutputStream , FileReader , PrintStream , PrintWriter , StringReader , StringWriter , File as JFile }
6+ import java . io .{ File as JFile , * }
7+ import java .nio . file . Files . readAllLines
78import java .text .SimpleDateFormat
89import java .util .Date
10+
11+ import core .Contexts .*
912import core .Decorators .*
13+ import interfaces .Diagnostic .{ERROR , WARNING }
14+ import io .AbstractFile
15+ import util .SourcePosition
16+ import Diagnostic .*
1017
1118import scala .collection .mutable
1219import scala .jdk .CollectionConverters .*
@@ -29,13 +36,17 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
2936 final def messages : Iterator [String ] = _messageBuf.iterator
3037
3138 protected final val _consoleBuf = new StringWriter
32- protected final val _consoleReporter = new ConsoleReporter (null , new PrintWriter (_consoleBuf))
39+ protected final val _consoleReporter = new ConsoleReporter (null , new PrintWriter (_consoleBuf)):
40+ override protected def renderPath (file : AbstractFile ): String = TestReporter .renderPath(file)
41+
3342 final def consoleOutput : String = _consoleBuf.toString
3443
3544 private var _skip : Boolean = false
3645 final def setSkip (): Unit = _skip = true
3746 final def skipped : Boolean = _skip
3847
48+ override protected def renderPath (file : AbstractFile ): String = TestReporter .renderPath(file)
49+
3950 protected final def inlineInfo (pos : SourcePosition )(using Context ): String =
4051 if (pos.exists) {
4152 if (pos.outer.exists)
@@ -149,10 +160,16 @@ object TestReporter {
149160 Properties .rerunFailed &&
150161 failedTestsFile.exists() &&
151162 failedTestsFile.isFile
152- )(java.nio.file. Files . readAllLines(failedTestsFile.toPath).asScala.toList)
163+ )(readAllLines(failedTestsFile.toPath).asScala.toList)
153164
154165 def writeFailedTests (tests : List [String ]): Unit =
155166 initLog()
156167 tests.foreach(failed => failedTestsWriter.println(failed))
157168 failedTestsWriter.flush()
169+
170+ def renderPath (file : AbstractFile ): String =
171+ if JFile .separatorChar == '\\ ' then
172+ file.path.replace('\\ ' , '/' )
173+ else
174+ file.path
158175}
0 commit comments