aboutsummaryrefslogtreecommitdiff
path: root/test/test/CompilerTest.scala
diff options
context:
space:
mode:
authorMartijn Hoekstra <Martijn Hoekstra>2016-09-03 12:10:53 +0200
committerMartijn Hoekstra <Martijn Hoekstra>2016-09-07 22:32:51 +0200
commit32819e2edc88dd06095704c04ed9c2dd0603386f (patch)
tree5ac33b7a4fc11fe5b13aeae26e963e5553e97fad /test/test/CompilerTest.scala
parent6bce106fea7ce10eefc864a6e7c1351675065880 (diff)
downloaddotty-32819e2edc88dd06095704c04ed9c2dd0603386f.tar.gz
dotty-32819e2edc88dd06095704c04ed9c2dd0603386f.tar.bz2
dotty-32819e2edc88dd06095704c04ed9c2dd0603386f.zip
honor -encoding compiler flag and defaults
rename test/pos/valueclasses to pos_valueclasses tests/pos/valueclasses generates a valueclasses.flags file in /tests/partest-generated/pos that conflicts with the valueClasses.flags file that tests/neg/valueClasses.scala tries to create
Diffstat (limited to 'test/test/CompilerTest.scala')
-rw-r--r--test/test/CompilerTest.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index d0e4b9a52..6bd5f7030 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -413,7 +413,8 @@ abstract class CompilerTest {
val flags = oldFlags.map(f => if (f == oldOutput) partestOutput else f) ++
List(s"-classpath $partestOutput") // Required for separate compilation tests
- getExisting(dest).isDifferent(source, flags, nerr) match {
+ val difference = getExisting(dest).isDifferent(source, flags, nerr)
+ difference match {
case NotExists => copyFiles(source, dest, partestOutput, flags, nerr, kind)
case ExistsSame => // nothing else to do
case ExistsDifferent =>
@@ -449,6 +450,7 @@ abstract class CompilerTest {
/** Recursively copy over source files and directories, excluding extensions
* that aren't in extensionsToCopy. */
private def recCopyFiles(sourceFile: Path, dest: Path): Unit = {
+
def copyfile(file: SFile, bytewise: Boolean): Unit = {
if (bytewise) {
val in = file.inputStream()
@@ -490,7 +492,7 @@ abstract class CompilerTest {
/** Reads the existing files for the given test source if any. */
private def getExisting(dest: Path): ExistingFiles = {
- val content: Option[Option[String]] = processFileDir(dest, f => f.safeSlurp, d => Some(""))
+ val content: Option[Option[String]] = processFileDir(dest, f => try Some(f.slurp("UTF8")) catch {case io: java.io.IOException => Some(io.toString())}, d => Some(""))
if (content.isDefined && content.get.isDefined) {
val flags = (dest changeExtension "flags").toFile.safeSlurp
val nerr = (dest changeExtension "nerr").toFile.safeSlurp
@@ -504,7 +506,7 @@ abstract class CompilerTest {
if (!genSrc.isDefined) {
NotExists
} else {
- val source = processFileDir(sourceFile, { f => f.safeSlurp }, { d => Some("") },
+ val source = processFileDir(sourceFile, { f => try Some(f.slurp("UTF8")) catch {case _: java.io.IOException => None} }, { d => Some("") },
Some("DPCompilerTest sourceFile doesn't exist: " + sourceFile)).get
if (source == genSrc) {
nerr match {