diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-03-20 15:44:10 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-03-29 10:33:25 +0200 |
commit | 0df3f618b2540ec0c87d16ef911f2f77bbe1b327 (patch) | |
tree | ac359d94bdf1954fcc564af0846475f73890658d /compiler/test | |
parent | d2e50d92be4038bf0ec07a61caff7959b8f2a583 (diff) | |
download | dotty-0df3f618b2540ec0c87d16ef911f2f77bbe1b327.tar.gz dotty-0df3f618b2540ec0c87d16ef911f2f77bbe1b327.tar.bz2 dotty-0df3f618b2540ec0c87d16ef911f2f77bbe1b327.zip |
Support copyToDir for tests that mutate original source
Diffstat (limited to 'compiler/test')
-rw-r--r-- | compiler/test/dotty/tools/dotc/CompilationTests.scala | 3 | ||||
-rw-r--r-- | compiler/test/dotty/tools/dotc/ParallelTesting.scala | 23 |
2 files changed, 18 insertions, 8 deletions
diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 3283e11ef..6ce5fe95a 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -20,8 +20,7 @@ class CompilationTests extends ParallelTesting { @Test def compilePosMixedFlags: Unit = { compileFile("../tests/pos/nullarify.scala", defaultOptions.and("-Ycheck:nullarify")) + - // this guy sucks, he changes the sourcefile itself: - // compileFile("../tests/pos-scala2/rewrites.scala", scala2Mode.and("-rewrite")) + + compileFile("../tests/pos-scala2/rewrites.scala", scala2Mode.and("-rewrite")).copyToTarget() + compileFile("../tests/pos-special/t8146a.scala", allowDeepSubtypes) + compileFile("../tests/pos-special/utf8encoded.scala", explicitUTF8) + compileFile("../tests/pos-special/utf16encoded.scala", explicitUTF16) + diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala index 0cb6e8d7c..c9b9a8f64 100644 --- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala +++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala @@ -479,6 +479,23 @@ trait ParallelTesting { this } + private def copyToDir(dir: JFile, file: JFile): JFile = { + val target = Paths.get(dir.getAbsolutePath, file.getName) + Files.copy(file.toPath, target, REPLACE_EXISTING) + if (file.isDirectory) file.listFiles.map(copyToDir(target.toFile, _)) + target.toFile + } + + def copyToTarget(): CompilationTest = new CompilationTest ( + targets.map { + case target @ ConcurrentCompilationTarget(files, _, outDir) => + target.copy(files = files.map(copyToDir(outDir,_))) + case target @ SeparateCompilationTarget(dir, _, outDir) => + target.copy(dir = copyToDir(outDir, dir)) + }, + times, shouldDelete, threadLimit + ) + def times(i: Int): CompilationTest = new CompilationTest(targets, i, shouldDelete, threadLimit) @@ -521,12 +538,6 @@ trait ParallelTesting { targetDir } - private def copyToDir(dir: JFile, file: JFile): Unit = { - val target = Paths.get(dir.getAbsolutePath, file.getName) - Files.copy(file.toPath, target, REPLACE_EXISTING) - if (file.isDirectory) file.listFiles.map(copyToDir(target.toFile, _)) - } - private def requirements(f: String, sourceDir: JFile, outDir: String): Unit = { require(sourceDir.isDirectory && sourceDir.exists, "passed non-directory to `compileFilesInDir`") require(outDir.last == '/', "please specify an `outDir` with a trailing slash") |