aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-04-13 16:29:18 +0200
committerFelix Mulder <felix.mulder@gmail.com>2017-04-13 16:29:18 +0200
commit28cbce5a6f00f600225c9b3787b564c39484beba (patch)
tree2b7dc75f23291b9384e5e48e8be6ad1b353d036e
parentb8ed254e38480eb8892eccd897d525d977d9e6a7 (diff)
downloaddotty-28cbce5a6f00f600225c9b3787b564c39484beba.zip
dotty-28cbce5a6f00f600225c9b3787b564c39484beba.tar.gz
dotty-28cbce5a6f00f600225c9b3787b564c39484beba.tar.bz2
Fix #2245: strip colors from strings before writing to file
-rw-r--r--compiler/test/dotty/tools/dotc/reporting/TestReporter.scala13
-rw-r--r--compiler/test/dotty/tools/vulpix/SummaryReport.scala7
2 files changed, 6 insertions, 14 deletions
diff --git a/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala b/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
index 213181b..d07d31c 100644
--- a/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
+++ b/compiler/test/dotty/tools/dotc/reporting/TestReporter.scala
@@ -28,18 +28,7 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
private[this] var _didCrash = false
final def compilerCrashed: Boolean = _didCrash
- final def flushToFile(): Unit =
- _messageBuf
- .iterator
- .map(_.replaceAll("\u001b\\[.*?m", ""))
- .foreach(filePrintln)
-
- final def flushToStdErr(): Unit =
- _messageBuf
- .iterator
- .foreach(System.err.println)
-
- final def inlineInfo(pos: SourcePosition): String =
+ protected final def inlineInfo(pos: SourcePosition): String =
if (pos.exists) {
if (pos.outer.exists)
s"\ninlined at ${pos.outer}:\n" + inlineInfo(pos.outer)
diff --git a/compiler/test/dotty/tools/vulpix/SummaryReport.scala b/compiler/test/dotty/tools/vulpix/SummaryReport.scala
index 678d888..dae83c1 100644
--- a/compiler/test/dotty/tools/vulpix/SummaryReport.scala
+++ b/compiler/test/dotty/tools/vulpix/SummaryReport.scala
@@ -131,11 +131,14 @@ final class SummaryReport extends SummaryReporting {
if (cleanUps.nonEmpty) cleanUps.foreach(_.apply())
}
+ private def removeColors(msg: String): String =
+ msg.replaceAll("\u001b\\[.*?m", "")
+
def echoToLog(msg: String): Unit =
- TestReporter.logPrintln(msg)
+ TestReporter.logPrintln(removeColors(msg))
def echoToLog(it: Iterator[String]): Unit = {
- it.foreach(TestReporter.logPrint)
+ it.foreach(msg => TestReporter.logPrint(removeColors(msg)))
TestReporter.logFlush()
}
}