aboutsummaryrefslogtreecommitdiff
path: root/test/test/CompilerTest.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-10-26 16:19:35 +0200
committerGuillaume Martres <smarter@ubuntu.com>2016-11-22 01:35:06 +0100
commit06a3d47ea9fd1b67b3acba9d115a16d18549e377 (patch)
tree36311873f40e1410154c50d00abb03715619e8cc /test/test/CompilerTest.scala
parent0da788c52121e44de6be0cdc7a0c4c6e1b125ff9 (diff)
downloaddotty-06a3d47ea9fd1b67b3acba9d115a16d18549e377.tar.gz
dotty-06a3d47ea9fd1b67b3acba9d115a16d18549e377.tar.bz2
dotty-06a3d47ea9fd1b67b3acba9d115a16d18549e377.zip
Move sjs, make sure that partest compiles everything in dirs
Diffstat (limited to 'test/test/CompilerTest.scala')
-rw-r--r--test/test/CompilerTest.scala27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index 5a4a9830a..05a7d62b8 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -442,8 +442,14 @@ abstract class CompilerTest {
nr: Int = 0, oldOutput: String = defaultOutputDir): Unit = {
val partestOutput = dest.jfile.getParentFile + JFile.separator + dest.stripExtension + "-" + kind + ".obj"
- val flags = oldFlags.map(f => if (f == oldOutput) partestOutput else f) ++
- List(s"-classpath $partestOutput") // Required for separate compilation tests
+
+ val altOutput =
+ source.getParentFile.getAbsolutePath.map(x => if (x == JFile.separatorChar) '_' else x)
+
+ val (beforeCp, remaining) = oldFlags
+ .map(f => if (f == oldOutput) partestOutput else f)
+ .span(_ != "-classpath")
+ val flags = beforeCp ++ List("-classpath", (partestOutput :: remaining.drop(1)).mkString(":"))
val difference = getExisting(dest).isDifferent(source, flags, nerr)
difference match {
@@ -451,8 +457,12 @@ abstract class CompilerTest {
case ExistsSame => // nothing else to do
case ExistsDifferent =>
val nextDest = dest.parent / (dest match {
- case d: Directory => Directory(replaceVersion(d.name, nr))
- case f => SFile(replaceVersion(f.stripExtension, nr)).addExtension(f.extension)
+ case d: Directory =>
+ val newVersion = replaceVersion(d.name, nr).getOrElse(altOutput)
+ Directory(newVersion)
+ case f =>
+ val newVersion = replaceVersion(f.stripExtension, nr).getOrElse(altOutput)
+ SFile(newVersion).addExtension(f.extension)
})
computeDestAndCopyFiles(source, nextDest, kind, flags, nerr, nr + 1, partestOutput)
}
@@ -555,13 +565,12 @@ abstract class CompilerTest {
import scala.util.matching.Regex
val nrFinder = """(.*_v)(\d+)""".r
/** Changes the version number suffix in the name (without extension). */
- private def replaceVersion(name: String, nr: Int): String = {
+ private def replaceVersion(name: String, nr: Int): Option[String] = {
val nrString = nr.toString
name match {
- case nrFinder(prefix, `nrString`) => prefix + (nr + 1)
- case _ =>
- assert(nr == 0, "DPCompilerTest couldn't create new version of files, match error")
- name + "_v1"
+ case nrFinder(prefix, `nrString`) => Some(prefix + (nr + 1))
+ case _ if nr != 0 => None
+ case _ => Some(name + "_v1")
}
}