1
- package dotty .tools
1
+ package dotty
2
+ package tools
2
3
package dotc
3
4
package reporting
4
5
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
7
8
import java .text .SimpleDateFormat
8
9
import java .util .Date
9
- import core .Decorators .*
10
10
11
- import scala .collection .mutable
12
- import scala .jdk .CollectionConverters .*
13
- import util .SourcePosition
14
11
import core .Contexts .*
15
- import Diagnostic .*
16
- import dotty .Properties
12
+ import core .Decorators .*
17
13
import interfaces .Diagnostic .{ERROR , WARNING }
14
+ import io .AbstractFile
15
+ import util .SourcePosition
16
+ import Diagnostic .*
18
17
19
- import scala .io . Codec
18
+ import scala .collection . mutable
20
19
import scala .compiletime .uninitialized
20
+ import scala .io .Codec
21
+ import scala .jdk .CollectionConverters .*
22
+ import scala .language .unsafeNulls
21
23
22
24
class TestReporter protected (outWriter : PrintWriter , logLevel : Int )
23
25
extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with MessageRendering {
@@ -30,13 +32,17 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
30
32
final def messages : Iterator [String ] = _messageBuf.iterator
31
33
32
34
protected final val _consoleBuf = new StringWriter
33
- protected final val _consoleReporter = new ConsoleReporter (null , new PrintWriter (_consoleBuf))
35
+ protected final val _consoleReporter = new ConsoleReporter (null , new PrintWriter (_consoleBuf)):
36
+ override protected def renderPath (file : AbstractFile ): String = TestReporter .renderPath(file)
37
+
34
38
final def consoleOutput : String = _consoleBuf.toString
35
39
36
40
private var _skip : Boolean = false
37
41
final def setSkip (): Unit = _skip = true
38
42
final def skipped : Boolean = _skip
39
43
44
+ override protected def renderPath (file : AbstractFile ): String = TestReporter .renderPath(file)
45
+
40
46
protected final def inlineInfo (pos : SourcePosition )(using Context ): String =
41
47
if (pos.exists) {
42
48
if (pos.outer.exists)
@@ -152,10 +158,16 @@ object TestReporter {
152
158
Properties .rerunFailed &&
153
159
failedTestsFile.exists() &&
154
160
failedTestsFile.isFile
155
- )(java.nio.file. Files . readAllLines(failedTestsFile.toPath).asScala.toList)
161
+ )(readAllLines(failedTestsFile.toPath).asScala.toList)
156
162
157
163
def writeFailedTests (tests : List [String ]): Unit =
158
164
initLog()
159
165
tests.foreach(failed => failedTestsWriter.println(failed))
160
166
failedTestsWriter.flush()
167
+
168
+ def renderPath (file : AbstractFile ): String =
169
+ if JFile .separatorChar == '\\ ' then
170
+ file.path.replace('\\ ' , '/' )
171
+ else
172
+ file.path
161
173
}
0 commit comments