Skip to content

Commit 68a67e1

Browse files
Set baseDirectory to ".." in tests
1 parent 9ce1d21 commit 68a67e1

15 files changed

+218
-218
lines changed

compiler/test/dotc/tests.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class tests extends CompilerTest {
2222
// tests that match regex '(pos|dotc|run|java|compileStdLib)\.*' would be
2323
// executed as benchmarks.
2424

25-
val defaultOutputDir = "../out/"
25+
val defaultOutputDir = "out/"
2626

2727
val noCheckOptions = List(
2828
// "-verbose",
@@ -85,7 +85,7 @@ class tests extends CompilerTest {
8585
val explicitUTF8 = List("-encoding", "UTF8")
8686
val explicitUTF16 = List("-encoding", "UTF16")
8787

88-
val testsDir = "../tests/"
88+
val testsDir = "tests/"
8989
val posDir = testsDir + "pos/"
9090
val posSpecialDir = testsDir + "pos-special/"
9191
val posScala2Dir = testsDir + "pos-scala2/"
@@ -103,7 +103,7 @@ class tests extends CompilerTest {
103103
val parsingDir = dotcDir + "parsing/"
104104
val dottyReplDir = dotcDir + "repl/"
105105
val typerDir = dotcDir + "typer/"
106-
val libDir = "../library/src/"
106+
val libDir = "library/src/"
107107

108108
def dottyBootedLib = compileDir(libDir, ".", List("-deep", "-Ycheck-reentrant", "-strict"))(allowDeepSubtypes) // note the -deep argument
109109
def dottyDependsOnBootedLib = compileDir(dottyDir, ".", List("-deep", "-Ycheck-reentrant"))(allowDeepSubtypes) // note the -deep argument
@@ -218,19 +218,19 @@ class tests extends CompilerTest {
218218
compileList("compileStdLib", stdlibFiles, "-migration" :: "-Yno-inline" :: scala2mode)
219219

220220
@Test def compileMixed = compileLine(
221-
"""../tests/pos/B.scala
222-
|../scala2-library/src/library/scala/collection/immutable/Seq.scala
223-
|../scala2-library/src/library/scala/collection/parallel/ParSeq.scala
224-
|../scala2-library/src/library/scala/package.scala
225-
|../scala2-library/src/library/scala/collection/GenSeqLike.scala
226-
|../scala2-library/src/library/scala/collection/SeqLike.scala
227-
|../scala2-library/src/library/scala/collection/generic/GenSeqFactory.scala""".stripMargin)(scala2mode ++ defaultOptions)
228-
@Test def compileIndexedSeq = compileLine("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala")
229-
@Test def compileParSetLike = compileLine("../scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala")
221+
"""tests/pos/B.scala
222+
|scala2-library/src/library/scala/collection/immutable/Seq.scala
223+
|scala2-library/src/library/scala/collection/parallel/ParSeq.scala
224+
|scala2-library/src/library/scala/package.scala
225+
|scala2-library/src/library/scala/collection/GenSeqLike.scala
226+
|scala2-library/src/library/scala/collection/SeqLike.scala
227+
|scala2-library/src/library/scala/collection/generic/GenSeqFactory.scala""".stripMargin)(scala2mode ++ defaultOptions)
228+
@Test def compileIndexedSeq = compileLine("scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala")
229+
@Test def compileParSetLike = compileLine("scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala")
230230
@Test def compileParSetSubset = compileLine(
231-
"""../scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala
232-
|../scala2-library/src/library/scala/collection/parallel/mutable/ParSet.scala
233-
|../scala2-library/src/library/scala/collection/mutable/SetLike.scala""".stripMargin)(scala2mode ++ defaultOptions)
231+
"""scala2-library/src/library/scala/collection/parallel/mutable/ParSetLike.scala
232+
|scala2-library/src/library/scala/collection/parallel/mutable/ParSet.scala
233+
|scala2-library/src/library/scala/collection/mutable/SetLike.scala""".stripMargin)(scala2mode ++ defaultOptions)
234234

235235
@Test def dottyBooted = {
236236
dottyBootedLib

compiler/test/dotty/tools/StdLibSources.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ object StdLibSources {
1010
/* For debug only */
1111
private val useExplicitWhiteList = false
1212

13-
private final val stdLibPath = "../scala2-library/src/library/"
13+
private final val stdLibPath = "scala2-library/src/library/"
1414

15-
def blacklistFile: String = "../compiler/test/dotc/scala-collections.blacklist"
16-
private def whitelistFile: String = "../compiler/test/dotc/scala-collections.whitelist"
15+
def blacklistFile: String = "compiler/test/dotc/scala-collections.blacklist"
16+
private def whitelistFile: String = "compiler/test/dotc/scala-collections.whitelist"
1717

1818
def whitelisted: List[String] = {
1919
lazy val whitelistBasedOnBlacklist = all.diff(blacklisted)

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 160 additions & 160 deletions
Large diffs are not rendered by default.

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FromTastyTests extends ParallelTesting {
2626
// > dotc -Ythrough-tasty -Ycheck:all <source>
2727

2828
implicit val testGroup: TestGroup = TestGroup("posTestFromTasty")
29-
val (step1, step2, step3) = compileTastyInDir("../tests/pos", defaultOptions,
29+
val (step1, step2, step3) = compileTastyInDir("tests/pos", defaultOptions,
3030
blacklist = Set(
3131
"macro-deprecate-dont-touch-backquotedidents.scala",
3232

@@ -88,7 +88,7 @@ class FromTastyTests extends ParallelTesting {
8888
// > dotr Test
8989

9090
implicit val testGroup: TestGroup = TestGroup("runTestFromTasty")
91-
val (step1, step2, step3) = compileTastyInDir("../tests/run", defaultOptions,
91+
val (step1, step2, step3) = compileTastyInDir("tests/run", defaultOptions,
9292
blacklist = Set(
9393
"t3613.scala",
9494
"t7223.scala",

compiler/test/dotty/tools/dotc/IdempotencyTests.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ class IdempotencyTests extends ParallelTesting {
3232

3333
def sourcesFrom(dir: Path) = CompilationTests.sources(Files.walk(dir))
3434

35-
val strawmanSources = sourcesFrom(Paths.get("../collection-strawman/collections/src/main"))
35+
val strawmanSources = sourcesFrom(Paths.get("collection-strawman/collections/src/main"))
3636
val strawmanSourcesSorted = strawmanSources.sorted
3737
val strawmanSourcesRevSorted = strawmanSourcesSorted.reverse
3838

3939
val posIdempotency = {
40-
compileFilesInDir("../tests/pos", opt)(TestGroup("idempotency/posIdempotency1")) +
41-
compileFilesInDir("../tests/pos", opt)(TestGroup("idempotency/posIdempotency2"))
40+
compileFilesInDir("tests/pos", opt)(TestGroup("idempotency/posIdempotency1")) +
41+
compileFilesInDir("tests/pos", opt)(TestGroup("idempotency/posIdempotency2"))
4242
}
4343

4444
val orderIdempotency = {
4545
(for {
46-
testDir <- new JFile("../tests/order-idempotency").listFiles() if testDir.isDirectory
46+
testDir <- new JFile("tests/order-idempotency").listFiles() if testDir.isDirectory
4747
} yield {
4848
val sources = sourcesFrom(testDir.toPath)
4949
compileList(testDir.getName, sources, opt)(TestGroup("idempotency/orderIdempotency1")) +
@@ -59,7 +59,7 @@ class IdempotencyTests extends ParallelTesting {
5959
}
6060

6161
def check(name: String) = {
62-
val files = List(s"../tests/idempotency/$name.scala", "../tests/idempotency/IdempotencyCheck.scala")
62+
val files = List(s"tests/idempotency/$name.scala", "tests/idempotency/IdempotencyCheck.scala")
6363
compileList(name, files, defaultOptions)(TestGroup("idempotency/check"))
6464
}
6565
val allChecks = {

compiler/test/dotty/tools/dotc/InterfaceEntryPointTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import java.nio.file._
2121
class InterfaceEntryPointTest {
2222
@Test def runCompilerFromInterface = {
2323
val sources =
24-
List("../tests/pos/HelloWorld.scala").map(p => Paths.get(p).toAbsolutePath().toString)
24+
List("tests/pos/HelloWorld.scala").map(p => Paths.get(p).toAbsolutePath().toString)
2525
val out = Paths.get("../out/").toAbsolutePath()
2626
if (Files.notExists(out))
2727
Files.createDirectory(out)

compiler/test/dotty/tools/dotc/LinkTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class LinkTests extends ParallelTesting {
3434
val linkCustomLibGroup = TestGroup("linkTest/linkCustomLib")
3535
val linkCustomLibTestGroup = TestGroup(linkCustomLibGroup + "/tests")
3636

37-
val strawmanLibrary = compileDir("../collection-strawman/collections/src/main", defaultOptions)(strawmanLibGroup)
38-
val linkCustomLib = compileDir("../tests/link/custom-lib", defaultOptions)(linkCustomLibGroup)
37+
val strawmanLibrary = compileDir("collection-strawman/collections/src/main", defaultOptions)(strawmanLibGroup)
38+
val linkCustomLib = compileDir("tests/link/custom-lib", defaultOptions)(linkCustomLibGroup)
3939

4040
val libraries = {
4141
strawmanLibrary +
@@ -49,7 +49,7 @@ class LinkTests extends ParallelTesting {
4949
val customLibClassFlags = mkLinkClassFlags(defaultOutputDir + linkCustomLibGroup + "/custom-lib")
5050

5151
// Link tests
52-
val linkDir = "../tests/link"
52+
val linkDir = "tests/link"
5353
val linkStramanDir = linkDir + "/strawman"
5454
val linkCustomLibDir = linkDir + "/on-custom-lib"
5555

compiler/test/dotty/tools/dotc/MissingCoreLibTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MissingCoreLibTests {
1111

1212
@Test def missingDottyLib: Unit = {
1313
val classPath = mkClassPath(Jars.dottyCompiler :: Jars.dottyInterfaces :: Jars.dottyExtras) // missing Jars.dottyLib
14-
val source = "../tests/pos/Foo.scala"
14+
val source = "tests/pos/Foo.scala"
1515
val options = Array("-classpath", classPath, source)
1616
val reporter = Main.process(options)
1717
assertEquals(1, reporter.errorCount)

compiler/test/dotty/tools/dotc/SettingsTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SettingsTests {
1919

2020
@Test def jarOutput: Unit = {
2121
val classPath = mkClassPath(Jars.dottyTestDeps)
22-
val source = "../tests/pos/Foo.scala"
22+
val source = "tests/pos/Foo.scala"
2323
val out = Paths.get("../out/jaredFoo.jar").normalize
2424
if (Files.exists(out)) Files.delete(out)
2525
val options = Array("-classpath", classPath, "-d", out.toString, source)

compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class ScannerTest extends DottyTest {
4949
@Test
5050
def scanList() = {
5151
println(System.getProperty("user.dir"))
52-
scan("./src/dotty/tools/dotc/core/Symbols.scala")
53-
scan("./src/dotty/tools/dotc/core/Symbols.scala")
52+
scan("compiler/src/dotty/tools/dotc/core/Symbols.scala")
53+
scan("compiler/src/dotty/tools/dotc/core/Symbols.scala")
5454
}
5555

5656
@Test

compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import reporting.TestReporter
1313
import vulpix.TestConfiguration
1414

1515
class PatmatExhaustivityTest {
16-
val testsDir = "../tests/patmat"
16+
val testsDir = "tests/patmat"
1717
// stop-after: patmatexhaust-huge.scala crash compiler
1818
val options = List("-color:never", "-Ystop-after:splitter", "-Ycheck-all-patmat", "-classpath", TestConfiguration.classPath)
1919

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,14 +817,14 @@ trait ParallelTesting extends RunnerOrchestration { self =>
817817
* "run" test:
818818
*
819819
* ```
820-
* compileFile("../tests/pos/i1103.scala", opts).pos()
820+
* compileFile("tests/pos/i1103.scala", opts).pos()
821821
* ```
822822
*
823823
* These tests can be customized before calling one of the execution
824824
* methods, for instance:
825825
*
826826
* ```
827-
* compileFile("../tests/pos/i1103.scala", opts).times(2).verbose.pos()
827+
* compileFile("tests/pos/i1103.scala", opts).times(2).verbose.pos()
828828
* ```
829829
*
830830
* Which would compile `i1103.scala` twice with the verbose flag as a "pos"

compiler/test/dotty/tools/vulpix/TestGroup.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package dotty.tools.vulpix
22

33
/** Test groups are used to ensure that the ouput of tests do not overlap.
4-
*
4+
*
55
* It can be used to disambiguate ouputs of tests that test the same file but with different options as shown in the following example.
6-
* compileFilesInDir("../tests/pos", defaultOptions)(TestGroup("compileStdLib")) // will output in ./out/compileStdLib/...
7-
* compileFilesInDir("../tests/pos", defaultOptimised)(TestGroup("optimised/testOptimised")) // will output in ./out/optimised/testOptimised/...
6+
* compileFilesInDir("tests/pos", defaultOptions)(TestGroup("compileStdLib")) // will output in ./out/compileStdLib/...
7+
* compileFilesInDir("tests/pos", defaultOptimised)(TestGroup("optimised/testOptimised")) // will output in ./out/optimised/testOptimised/...
88
*/
99
class TestGroup(val name: String) extends AnyVal {
1010
override def toString: String = name

compiler/test/dotty/tools/vulpix/VulpixTests.scala

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class VulpixTests extends ParallelTesting {
2323

2424
@Test def missingFile: Unit =
2525
try {
26-
compileFile("../tests/partest-test/i-dont-exist.scala", defaultOptions).expectFailure.checkExpectedErrors()
26+
compileFile("tests/partest-test/i-dont-exist.scala", defaultOptions).expectFailure.checkExpectedErrors()
2727
fail("didn't fail properly")
2828
}
2929
catch {
@@ -32,52 +32,52 @@ class VulpixTests extends ParallelTesting {
3232
}
3333

3434
@Test def pos1Error: Unit =
35-
compileFile("../tests/partest-test/posFail1Error.scala", defaultOptions).expectFailure.checkCompile()
35+
compileFile("tests/partest-test/posFail1Error.scala", defaultOptions).expectFailure.checkCompile()
3636

3737
@Test def negMissingAnnot: Unit =
38-
compileFile("../tests/partest-test/negMissingAnnot.scala", defaultOptions).expectFailure.checkExpectedErrors()
38+
compileFile("tests/partest-test/negMissingAnnot.scala", defaultOptions).expectFailure.checkExpectedErrors()
3939

4040
@Test def negAnnotWrongLine: Unit =
41-
compileFile("../tests/partest-test/negAnnotWrongLine.scala", defaultOptions).expectFailure.checkExpectedErrors()
41+
compileFile("tests/partest-test/negAnnotWrongLine.scala", defaultOptions).expectFailure.checkExpectedErrors()
4242

4343
@Test def negTooManyAnnots: Unit =
44-
compileFile("../tests/partest-test/negTooManyAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()
44+
compileFile("tests/partest-test/negTooManyAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()
4545

4646
@Test def negNoPositionAnnot: Unit =
47-
compileFile("../tests/partest-test/negNoPositionAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()
47+
compileFile("tests/partest-test/negNoPositionAnnots.scala", defaultOptions).expectFailure.checkExpectedErrors()
4848

4949
@Test def runCompileFail: Unit =
50-
compileFile("../tests/partest-test/posFail1Error.scala", defaultOptions).expectFailure.checkRuns()
50+
compileFile("tests/partest-test/posFail1Error.scala", defaultOptions).expectFailure.checkRuns()
5151

5252
@Test def runWrongOutput1: Unit =
53-
compileFile("../tests/partest-test/runWrongOutput1.scala", defaultOptions).expectFailure.checkRuns()
53+
compileFile("tests/partest-test/runWrongOutput1.scala", defaultOptions).expectFailure.checkRuns()
5454

5555
@Test def runWrongOutput2: Unit =
56-
compileFile("../tests/partest-test/runWrongOutput2.scala", defaultOptions).expectFailure.checkRuns()
56+
compileFile("tests/partest-test/runWrongOutput2.scala", defaultOptions).expectFailure.checkRuns()
5757

5858
@Test def runDiffOutput1: Unit =
59-
compileFile("../tests/partest-test/runDiffOutput1.scala", defaultOptions).expectFailure.checkRuns()
59+
compileFile("tests/partest-test/runDiffOutput1.scala", defaultOptions).expectFailure.checkRuns()
6060

6161
@Test def runStackOverflow: Unit =
62-
compileFile("../tests/partest-test/stackOverflow.scala", defaultOptions).expectFailure.checkRuns()
62+
compileFile("tests/partest-test/stackOverflow.scala", defaultOptions).expectFailure.checkRuns()
6363

6464
@Test def runOutRedirects: Unit =
65-
compileFile("../tests/partest-test/i2147.scala", defaultOptions).expectFailure.checkRuns()
65+
compileFile("tests/partest-test/i2147.scala", defaultOptions).expectFailure.checkRuns()
6666

6767
@Test def infiteNonRec: Unit =
68-
compileFile("../tests/partest-test/infinite.scala", defaultOptions).expectFailure.checkRuns()
68+
compileFile("tests/partest-test/infinite.scala", defaultOptions).expectFailure.checkRuns()
6969

7070
@Test def infiteTailRec: Unit =
71-
compileFile("../tests/partest-test/infiniteTail.scala", defaultOptions).expectFailure.checkRuns()
71+
compileFile("tests/partest-test/infiniteTail.scala", defaultOptions).expectFailure.checkRuns()
7272

7373
@Test def infiniteAlloc: Unit =
74-
compileFile("../tests/partest-test/infiniteAlloc.scala", defaultOptions).expectFailure.checkRuns()
74+
compileFile("tests/partest-test/infiniteAlloc.scala", defaultOptions).expectFailure.checkRuns()
7575

7676
@Test def deadlock: Unit =
77-
compileFile("../tests/partest-test/deadlock.scala", defaultOptions).expectFailure.checkRuns()
77+
compileFile("tests/partest-test/deadlock.scala", defaultOptions).expectFailure.checkRuns()
7878

7979
@Test def badJava: Unit =
80-
try compileFile("../tests/partest-test/BadJava.java", defaultOptions).suppressAllOutput.checkCompile()
80+
try compileFile("tests/partest-test/BadJava.java", defaultOptions).suppressAllOutput.checkCompile()
8181
catch {
8282
case ae: AssertionError => assert(ae.getMessage.contains("java compilation failed"))
8383
}

project/Build.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ object Build {
497497

498498
// For convenience, change the baseDirectory when running the compiler
499499
baseDirectory in (Compile, run) := baseDirectory.value / "..",
500-
// .. but not when running test
501-
baseDirectory in (Test, run) := baseDirectory.value,
500+
// And when running the tests
501+
baseDirectory in Test := baseDirectory.value / "..",
502502

503503
test in Test := {
504504
// Exclude legacy tests by default

0 commit comments

Comments
 (0)