Skip to content

Commit 08060e8

Browse files
authored
Merge pull request scala#10789 from som-snytt/tweak/relative-path-in-test
Appease windows paths perhaps
2 parents 41c795e + 340960e commit 08060e8

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

test/files/run/t12289.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

2-
import scala.tools.partest.StoreReporterDirectTest
2+
import scala.reflect.io.AbstractFile
33
import scala.tools.nsc._
4+
import scala.tools.partest.StoreReporterDirectTest
45
import scala.util.chaining._
56

67
object Test extends StoreReporterDirectTest {
@@ -15,13 +16,14 @@ object Test extends StoreReporterDirectTest {
1516
def code = rounds(round).tap(_ => round += 1)
1617
// intercept the settings created for compile()
1718
override def newSettings(args: List[String]) = {
18-
val outDir = testOutput.parent / testOutput / s"test-output-$round"
19-
def prevOutDir = testOutput.parent / testOutput / s"test-output-${round - 1}"
20-
outDir.createDirectory()
19+
val outDir = testOutput / s"test-output-$round"
20+
def prevOutDir = testOutput / s"test-output-${round - 1}"
21+
outDir.createDirectory(force = true)
22+
val af = AbstractFile.getDirectory(outDir)
2123
// put the previous round on the class path
22-
val args1 = "-d" :: outDir.path :: args
23-
val args2 = if (round > 0) "-cp" :: prevOutDir.path :: args1 else args1
24-
super.newSettings(args2)
24+
val args1 = if (round > 0) "-cp" :: prevOutDir.path :: args else args
25+
super.newSettings(args1)
26+
.tap(_.outputDirs.setSingleOutput(af))
2527
}
2628
// avoid setting -d
2729
override def newCompiler(args: String*): Global = {

test/files/run/t12289b.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

2-
import scala.tools.partest.StoreReporterDirectTest
2+
import scala.reflect.io.AbstractFile
33
import scala.tools.nsc._
4+
import scala.tools.partest.StoreReporterDirectTest
45
import scala.util.chaining._
56

67
object Test extends StoreReporterDirectTest {
@@ -17,13 +18,14 @@ object Test extends StoreReporterDirectTest {
1718
def code = rounds(round).tap(_ => round += 1)
1819
// intercept the settings created for compile()
1920
override def newSettings(args: List[String]) = {
20-
val outDir = testOutput.parent / testOutput / s"test-output-$round"
21-
def prevOutDir = testOutput.parent / testOutput / s"test-output-${round - 1}"
22-
outDir.createDirectory()
21+
val outDir = testOutput / s"test-output-$round"
22+
def prevOutDir = testOutput / s"test-output-${round - 1}"
23+
outDir.createDirectory(force = true)
24+
val af = AbstractFile.getDirectory(outDir)
2325
// put the previous round on the class path
24-
val args1 = "-d" :: outDir.path :: args
25-
val args2 = if (round > 0) "-cp" :: prevOutDir.path :: args1 else args1
26-
super.newSettings(args2)
26+
val args1 = if (round > 0) "-cp" :: prevOutDir.path :: args else args
27+
super.newSettings(args1)
28+
.tap(_.outputDirs.setSingleOutput(af))
2729
}
2830
// avoid setting -d
2931
override def newCompiler(args: String*): Global = {

test/files/run/t12289c.scala

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
import scala.tools.partest.StoreReporterDirectTest
32
import scala.tools.nsc._
3+
import scala.tools.partest.StoreReporterDirectTest
44
import scala.util.chaining._
55

66
object Test extends StoreReporterDirectTest {
@@ -16,15 +16,13 @@ object Test extends StoreReporterDirectTest {
1616
else code1.tap(_ => round += 1)
1717
// intercept the settings created for compile()
1818
override def newSettings(args: List[String]) = {
19-
val outDir = testOutput.parent / testOutput / s"test-output-$round"
20-
def prevOutDir = testOutput.parent / testOutput / s"test-output-${round - 1}"
21-
outDir.createDirectory()
19+
val outDir = testOutput / s"test-output-$round"
20+
def prevOutDir = testOutput / s"test-output-${round - 1}"
21+
outDir.createDirectory(force = true)
2222
// put the previous round on the class path
23-
val ss =
24-
if (round > 0) super.newSettings("-cp" :: prevOutDir.path :: args)
25-
else super.newSettings(args)
26-
ss.outputDirs.add(srcDir = testPath.parent.path, outDir = outDir.path)
27-
ss
23+
val args1 = if (round > 0) "-cp" :: prevOutDir.path :: args else args
24+
super.newSettings(args1)
25+
.tap(_.outputDirs.add(srcDir = testPath.parent.path, outDir = outDir.path))
2826
}
2927
// avoid setting -d
3028
override def newCompiler(args: String*): Global = {

0 commit comments

Comments
 (0)