diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 1 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 42 |
2 files changed, 13 insertions, 30 deletions
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 0ae42ce707..83dc88eff0 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -797,7 +797,6 @@ trait ScalacSettings { val Xshowobj = StringSetting ("-Xshow-object", "object", "Show object info", "") val showPhases = BooleanSetting ("-Xshow-phases", "Print a synopsis of compiler phases") val sourceReader = StringSetting ("-Xsource-reader", "classname", "Specify a custom method for reading source files", "scala.tools.nsc.io.SourceReader") - val newArrays = BooleanSetting ("-Ynewarrays", "Generate code for new array scheme") /** * -Y "Private" settings diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index ec02009728..53c270bdbd 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -109,11 +109,10 @@ class Worker(val fileManager: FileManager) extends Actor { } def createOutputDir(dir: File, fileBase: String, kind: String): File = { - val outDir = new File(dir, fileBase + "-" + kind + ".obj") - if (!outDir.exists) - outDir.mkdir() - createdOutputDirs = outDir :: createdOutputDirs - outDir + val outDir = io.Path(dir) / io.Directory("%s-%s.obj".format(fileBase, kind)) + outDir.createDirectory() + createdOutputDirs ::= outDir.jfile + outDir.jfile } /* Note: not yet used/tested. */ @@ -304,34 +303,19 @@ class Worker(val fileManager: FileManager) extends Actor { } def compareOutput(dir: File, fileBase: String, kind: String, logFile: File): String = { - // if check file exists, compare with log file - val checkFile = { - val chkFile = new File(dir, fileBase + ".check") - if (chkFile.isFile) - chkFile - else - new File(dir, fileBase + "-" + kind + ".check") + def getCheckFile(s: String) = { + val f = io.Path(dir) / io.File("%s%s.check".format(fileBase, s)) + if (f.isFile && f.canRead) Some(f) else None } - if (!checkFile.exists || !checkFile.canRead) { - val reader = new BufferedReader(new FileReader(logFile)) - val swriter = new StringWriter - val pwriter = new PrintWriter(swriter, true) - val appender = new StreamAppender(reader, pwriter) - appender.run() - swriter.toString + + // if check file exists, compare with log file + (getCheckFile("") orElse getCheckFile("-" + kind)) match { + case Some(f) => fileManager.compareFiles(logFile, f.jfile) + case _ => file2String(logFile) } - else fileManager.compareFiles(logFile, checkFile) } - def file2String(logFile: File) = { - val logReader = new BufferedReader(new FileReader(logFile)) - val strWriter = new StringWriter - val logWriter = new PrintWriter(strWriter, true) - val logAppender = new StreamAppender(logReader, logWriter) - logAppender.run() - logReader.close() - strWriter.toString - } + def file2String(logFile: File) = io.File(logFile).slurp() /** Runs a list of tests. * |