Skip to content

Commit 20cb2a5

Browse files
committed
Rewrites to case classes and enums
1 parent 4659bd9 commit 20cb2a5

File tree

5 files changed

+23
-30
lines changed

5 files changed

+23
-30
lines changed

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

Lines changed: 0 additions & 3 deletions
This file was deleted.

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
5252
* all tests. All absolute paths that contain any of the substrings in `testFilter`
5353
* will be run
5454
*/
55+
// TODO: Why not just use a FileFilter ??
5556
def testFilter: List[String]
5657

5758
/** Tests should override the checkfiles with the current output */
@@ -868,18 +869,18 @@ trait ParallelTesting extends RunnerOrchestration { self =>
868869
private def verifyOutput(checkFile: Option[JFile], dir: JFile, testSource: TestSource, warnings: Int, reporters: Seq[TestReporter], logger: LoggedRunnable) = {
869870
if Properties.testsNoRun then addNoRunWarning()
870871
else runMain(testSource.runClassPath, testSource.allToolArgs) match {
871-
case Success(output) => checkFile match {
872+
case Status.Success(output) => checkFile match {
872873
case Some(file) if file.exists => diffTest(testSource, file, output.linesIterator.toList, reporters, logger)
873874
case _ =>
874875
}
875-
case Failure(output) =>
876+
case Status.Failure(output) =>
876877
if output == "" then
877878
echo(s"Test '${testSource.title}' failed with no output")
878879
else
879880
echo(s"Test '${testSource.title}' failed with output:")
880881
echo(output)
881882
failTestSource(testSource)
882-
case Timeout =>
883+
case Status.Timeout =>
883884
echo("failed because test " + testSource.title + " timed out")
884885
failTestSource(testSource, TimeoutFailure(testSource.title))
885886
}
@@ -1589,16 +1590,14 @@ trait ParallelTesting extends RunnerOrchestration { self =>
15891590
}.getOrElse(StandardCharsets.UTF_8)
15901591
}
15911592

1592-
object ParallelTesting {
1593+
object ParallelTesting:
15931594

1594-
def defaultOutputDir: String = "out"+JFile.separator
1595+
def defaultOutputDir: String = s"out${JFile.separator}"
15951596

1596-
def isSourceFile(f: JFile): Boolean = {
1597+
def isSourceFile(f: JFile): Boolean =
15971598
val name = f.getName
15981599
name.endsWith(".scala") || name.endsWith(".java")
1599-
}
16001600

16011601
def isTastyFile(f: JFile): Boolean =
16021602
f.getName.endsWith(".tasty")
16031603

1604-
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,22 @@ trait RunnerOrchestration {
138138
childOutput = childStdout.readLine()
139139
}
140140

141-
if (process.isAlive && childOutput != null) Success(sb.toString)
142-
else Failure(sb.toString)
141+
if (process.isAlive && childOutput != null) Status.Success(sb.toString)
142+
else Status.Failure(sb.toString)
143143
}
144144

145145
// Await result for `maxDuration` and then timout and destroy the
146146
// process:
147147
val status =
148148
try Await.result(readOutput, maxDuration)
149-
catch { case _: TimeoutException => Timeout }
149+
catch { case _: TimeoutException => Status.Timeout }
150150

151151
// Handle failure of the VM:
152152
status match {
153-
case _: Success if safeMode => respawn()
154-
case _: Success => // no need to respawn sub process
155-
case _: Failure => respawn()
156-
case Timeout => respawn()
153+
case _: Status.Success if safeMode => respawn()
154+
case _: Status.Success => // no need to respawn sub process
155+
case _: Status.Failure => respawn()
156+
case Status.Timeout => respawn()
157157
}
158158
status
159159
}

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

Lines changed: 0 additions & 7 deletions
This file was deleted.

compiler/test/dotty/tools/vulpix/TestGroup.scala renamed to compiler/test/dotty/tools/vulpix/package.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ package dotty.tools.vulpix
66
* compileFilesInDir("tests/pos", defaultOptions)(TestGroup("compileStdLib")) // will output in ./out/compileStdLib/...
77
* compileFilesInDir("tests/pos", defaultOptimised)(TestGroup("optimised/testOptimised")) // will output in ./out/optimised/testOptimised/...
88
*/
9-
class TestGroup(val name: String) extends AnyVal {
9+
case class TestGroup(val name: String) extends AnyVal:
1010
override def toString: String = name
11-
}
1211

13-
object TestGroup {
14-
def apply(name: String): TestGroup = new TestGroup(name)
15-
}
12+
/** ??? */
13+
enum Status:
14+
case Success(output: String)
15+
case Failure(output: String)
16+
case Timeout
17+
18+
/** ??? */
19+
case class FailedTestInfo(title: String, extra: String)

0 commit comments

Comments
 (0)