From 4feca9a871a0a47c7dfe077590b2d29437342ab0 Mon Sep 17 00:00:00 2001 From: Dotty CI Date: Tue, 29 Jan 2019 16:18:29 +0100 Subject: [PATCH 1/3] fix for test 'repl\i5218' --- .../src/dotty/tools/dotc/printing/Texts.scala | 2 +- .../test/dotty/tools/repl/ScriptedTests.scala | 16 ++++++++++++---- .../dotty/tools/vulpix/RunnerOrchestration.scala | 5 ++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/printing/Texts.scala b/compiler/src/dotty/tools/dotc/printing/Texts.scala index 20d01151a144..e3921a17429c 100644 --- a/compiler/src/dotty/tools/dotc/printing/Texts.scala +++ b/compiler/src/dotty/tools/dotc/printing/Texts.scala @@ -117,7 +117,7 @@ object Texts { case _ => var follow = false for (elem <- relems.reverse) { - if (follow) sb.append("\n") + if (follow) sb.append(System.lineSeparator) elem.print(sb, numberWidth) follow = true } diff --git a/compiler/test/dotty/tools/repl/ScriptedTests.scala b/compiler/test/dotty/tools/repl/ScriptedTests.scala index a517145d235e..0e64a7b4499a 100644 --- a/compiler/test/dotty/tools/repl/ScriptedTests.scala +++ b/compiler/test/dotty/tools/repl/ScriptedTests.scala @@ -60,6 +60,16 @@ class ScriptedTests extends ReplTest with MessageRendering { case nonEmptyLine => nonEmptyLine :: Nil } + def printOutput(prefix: String, output: String): Unit = { + val bytes = output.getBytes + println(prefix+ + " (#chars="+output.length+ + ", #CR="+(bytes.count(_ == 13))+ + ", #LF="+(bytes.count(_ == 10))+ + ") ========>"+EOL+ + output.replaceAll("\r", "").replaceAll("\n", ""+EOL)) + } + val expectedOutput = Source.fromFile(f, "UTF-8").getLines().flatMap(filterEmpties).mkString(EOL) val actualOutput = { @@ -79,10 +89,8 @@ class ScriptedTests extends ReplTest with MessageRendering { } if (expectedOutput != actualOutput) { - println("expected =========>") - println(expectedOutput) - println("actual ===========>") - println(actualOutput) + printOutput("expected", expectedOutput) + printOutput("actual", actualOutput) fail(s"Error in file $f, expected output did not match actual") } diff --git a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala index 2fb3a275402a..bd21ead291c9 100644 --- a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala +++ b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala @@ -3,7 +3,7 @@ package tools package vulpix import java.io.{ File => JFile, InputStreamReader, BufferedReader, PrintStream } -import java.nio.file.Paths; +import java.nio.file.Paths import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.TimeoutException @@ -156,10 +156,9 @@ trait RunnerOrchestration { * scala library. */ private def createProcess: Process = { - val sep = JFile.separator val url = classOf[ChildJVMMain].getProtectionDomain.getCodeSource.getLocation val cp = Paths.get(url.toURI).toString + JFile.pathSeparator + Properties.scalaLibrary - val javaBin = sys.props("java.home") + sep + "bin" + sep + "java" + val javaBin = Paths.get(sys.props("java.home"), "bin", "java").toString new ProcessBuilder(javaBin, "-Dfile.encoding=UTF-8", "-Xmx1g", "-cp", cp, "dotty.tools.vulpix.ChildJVMMain") .redirectErrorStream(true) .redirectInput(ProcessBuilder.Redirect.PIPE) From ede30c220042722e0baf052cdb4e66f33ca873ef Mon Sep 17 00:00:00 2001 From: Dotty CI Date: Tue, 29 Jan 2019 16:42:33 +0100 Subject: [PATCH 2/3] removed leading tab --- compiler/test/dotty/tools/repl/ScriptedTests.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/test/dotty/tools/repl/ScriptedTests.scala b/compiler/test/dotty/tools/repl/ScriptedTests.scala index 0e64a7b4499a..0556fea0fb1b 100644 --- a/compiler/test/dotty/tools/repl/ScriptedTests.scala +++ b/compiler/test/dotty/tools/repl/ScriptedTests.scala @@ -62,7 +62,7 @@ class ScriptedTests extends ReplTest with MessageRendering { def printOutput(prefix: String, output: String): Unit = { val bytes = output.getBytes - println(prefix+ + println(prefix+ " (#chars="+output.length+ ", #CR="+(bytes.count(_ == 13))+ ", #LF="+(bytes.count(_ == 10))+ From ee41fbc47437c9f9e933d3b35022fe2738804c61 Mon Sep 17 00:00:00 2001 From: Dotty CI Date: Tue, 29 Jan 2019 17:00:33 +0100 Subject: [PATCH 3/3] removed change in ScriptedTests.scala --- .../test/dotty/tools/repl/ScriptedTests.scala | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/compiler/test/dotty/tools/repl/ScriptedTests.scala b/compiler/test/dotty/tools/repl/ScriptedTests.scala index 0556fea0fb1b..a517145d235e 100644 --- a/compiler/test/dotty/tools/repl/ScriptedTests.scala +++ b/compiler/test/dotty/tools/repl/ScriptedTests.scala @@ -60,16 +60,6 @@ class ScriptedTests extends ReplTest with MessageRendering { case nonEmptyLine => nonEmptyLine :: Nil } - def printOutput(prefix: String, output: String): Unit = { - val bytes = output.getBytes - println(prefix+ - " (#chars="+output.length+ - ", #CR="+(bytes.count(_ == 13))+ - ", #LF="+(bytes.count(_ == 10))+ - ") ========>"+EOL+ - output.replaceAll("\r", "").replaceAll("\n", ""+EOL)) - } - val expectedOutput = Source.fromFile(f, "UTF-8").getLines().flatMap(filterEmpties).mkString(EOL) val actualOutput = { @@ -89,8 +79,10 @@ class ScriptedTests extends ReplTest with MessageRendering { } if (expectedOutput != actualOutput) { - printOutput("expected", expectedOutput) - printOutput("actual", actualOutput) + println("expected =========>") + println(expectedOutput) + println("actual ===========>") + println(actualOutput) fail(s"Error in file $f, expected output did not match actual") }