Skip to content

Commit 6201892

Browse files
committed
Tweak TestGroup
1 parent 8b27ecb commit 6201892

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ package dotc
44

55
import scala.language.unsafeNulls
66

7-
import org.junit.{ Test, BeforeClass, AfterClass }
8-
import org.junit.Assert._
9-
import org.junit.Assume._
7+
import org.junit.{ Test, AfterClass }
108
import org.junit.experimental.categories.Category
119

1210
import scala.concurrent.duration._
@@ -96,7 +94,7 @@ class BootstrappedOnlyCompilationTests {
9694
// Negative tests ------------------------------------------------------------
9795

9896
@Test def negMacros: Unit = {
99-
implicit val testGroup: TestGroup = TestGroup("compileNegWithCompiler")
97+
given TestGroup = TestGroup("negMacros")
10098
compileFilesInDir("tests/neg-macros", defaultOptions.and("-Xcheck-macros"))
10199
.checkExpectedErrors()
102100
}

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,27 @@ package vulpix
44

55
import scala.language.unsafeNulls
66

7-
import java.io.{File => JFile, IOException, PrintStream, ByteArrayOutputStream}
8-
import java.lang.System.{lineSeparator => EOL}
9-
import java.net.URL
7+
import java.io.File => JFile
108
import java.nio.file.StandardCopyOption.REPLACE_EXISTING
11-
import java.nio.file.{Files, NoSuchFileException, Path, Paths}
9+
import java.nio.file.{Files, NoSuchFileException, Paths}
1210
import java.nio.charset.{Charset, StandardCharsets}
13-
import java.text.SimpleDateFormat
1411
import java.util.{HashMap, Timer, TimerTask}
1512
import java.util.concurrent.{ExecutionException, TimeUnit, TimeoutException, Executors => JExecutors}
1613

1714
import scala.collection.mutable
1815
import scala.io.{Codec, Source}
1916
import scala.jdk.CollectionConverters.*
2017
import scala.util.{Random, Try, Failure => TryFailure, Success => TrySuccess, Using}
21-
import scala.util.control.NonFatal
22-
import scala.util.matching.Regex
2318
import scala.collection.mutable.ListBuffer
2419

2520
import dotc.{Compiler, Driver}
2621
import dotc.core.Contexts.*
27-
import dotc.decompiler
2822
import dotc.report
2923
import dotc.interfaces.Diagnostic.ERROR
3024
import dotc.reporting.{Reporter, TestReporter}
3125
import dotc.reporting.Diagnostic
32-
import dotc.config.Config
33-
import dotc.util.{DiffUtil, SourceFile, SourcePosition, Spans, NoSourcePosition}
26+
import dotc.util.{SourceFile, SourcePosition, Spans, NoSourcePosition}
3427
import io.AbstractFile
35-
import dotty.tools.vulpix.TestConfiguration.defaultOptions
3628

3729
/** A parallel testing suite whose goal is to integrate nicely with JUnit
3830
*
@@ -1452,7 +1444,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
14521444
* By default, files are compiled in alphabetical order. An optional seed
14531445
* can be used for randomization.
14541446
*/
1455-
def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, recursive: Boolean = true)(implicit testGroup: TestGroup): CompilationTest = {
1447+
def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, recursive: Boolean = true)(using testGroup: TestGroup): CompilationTest = {
14561448
val outDir = defaultOutputDir + testGroup + JFile.separator
14571449
val sourceDir = new JFile(f)
14581450
checkRequirements(f, sourceDir, outDir)

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package dotty.tools.vulpix
22

33
/** Test groups are used to ensure that the output of tests do not overlap.
44
*
5-
* It can be used to disambiguate ouputs of tests that test the same file but with different options as shown in the following example.
5+
* A test group can be used to disambiguate outputs of tests that test the same file
6+
* but with different options as shown in the following example.
7+
*
68
* compileFilesInDir("tests/pos", defaultOptions)(TestGroup("compileStdLib")) // will output in ./out/compileStdLib/...
79
* compileFilesInDir("tests/pos", defaultOptimised)(TestGroup("optimised/testOptimised")) // will output in ./out/optimised/testOptimised/...
810
*/
9-
class TestGroup(val name: String) extends AnyVal {
10-
override def toString: String = name
11-
}
1211

13-
object TestGroup {
14-
def apply(name: String): TestGroup = new TestGroup(name)
15-
}
12+
opaque type TestGroup = String
13+
14+
object TestGroup:
15+
inline def apply(inline name: String): TestGroup = name
16+
extension (inline group: TestGroup) inline def name: String = group

0 commit comments

Comments
 (0)