Skip to content

Commit 81e1b25

Browse files
committed
chore: refactor misc minor things in unit tests
1 parent 15f8af8 commit 81e1b25

File tree

10 files changed

+13
-26
lines changed

10 files changed

+13
-26
lines changed

modules/build-macros/src/test/scala/scala/build/CPSTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CPSTest extends munit.FunSuite {
77
val failed1: Either[Int, String] = Left(1)
88
val ok: Either[Int, String] = Right("OK")
99

10-
def checkResult(expected: Either[Int, String])(res: => Either[Int, String]) =
10+
def checkResult(expected: Either[Int, String])(res: => Either[Int, String]): Unit =
1111
assertEquals(expected, res)
1212

1313
test("Basic CPS test") {

modules/build/src/test/scala/scala/build/tests/BuildTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class BuildTests(server: Boolean) extends TestUtil.ScalaCliBuildSuite {
4545
)
4646
)
4747

48-
def sv2: String = Constants.defaultScala213Version
48+
def sv2: String = Constants.defaultScala213Version
4949
val defaultOptions: BuildOptions = baseOptions.copy(
5050
scalaOptions = baseOptions.scalaOptions.copy(
5151
scalaVersion = Some(MaybeScalaVersion(sv2)),
@@ -54,7 +54,7 @@ abstract class BuildTests(server: Boolean) extends TestUtil.ScalaCliBuildSuite {
5454
scriptOptions = ScriptOptions(Some(true))
5555
)
5656

57-
def sv3: String = Constants.defaultScalaVersion
57+
def sv3: String = Constants.defaultScalaVersion
5858
val defaultScala3Options: BuildOptions = defaultOptions.copy(
5959
scalaOptions = defaultOptions.scalaOptions.copy(
6060
scalaVersion = Some(MaybeScalaVersion(sv3)),

modules/cli/src/test/scala/cli/commands/tests/ReplOptionsTests.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import scala.cli.commands.repl.{Repl, ReplOptions, SharedReplOptions}
77
import scala.cli.commands.shared.{SharedOptions, SharedPythonOptions}
88

99
class ReplOptionsTests extends munit.FunSuite {
10-
1110
test("ScalaPy version") {
1211
val ver = "X.Y.Z"
1312
val replOptions = ReplOptions(
@@ -32,5 +31,4 @@ class ReplOptionsTests extends munit.FunSuite {
3231
val buildOptions = Repl.buildOptions0(replOptions, maxVersion, maxLtsVersion)
3332
expect(buildOptions.scalaOptions.scalaVersion.flatMap(_.versionOpt).contains(maxVersion))
3433
}
35-
3634
}

modules/cli/src/test/scala/cli/commands/tests/RunOptionsTests.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import scala.cli.commands.run.{Run, RunOptions}
66
import scala.cli.commands.shared.{SharedOptions, SharedPythonOptions}
77

88
class RunOptionsTests extends munit.FunSuite {
9-
109
test("ScalaPy version") {
1110
val ver = "X.Y.Z"
1211
val runOptions = RunOptions(
@@ -51,5 +50,4 @@ class RunOptionsTests extends munit.FunSuite {
5150
expect(toolkitDep.name == "toolkit")
5251
expect(toolkitDep.version == "latest.release")
5352
}
54-
5553
}

modules/cli/src/test/scala/cli/tests/ArgSplitterTest.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ class ArgSplitterTest extends TestUtil.ScalaCliSuite {
1212
val input = args.map(_.mkString(" ", " ", "")).mkString(" ", "\n", "")
1313
assertEquals(ArgSplitter.splitToArgs(input), args.flatten)
1414
}
15-
1615
}

modules/cli/src/test/scala/cli/tests/LauncherCliTest.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import scala.cli.commands.shared.CoursierOptions
88
import scala.cli.launcher.LauncherCli
99

1010
class LauncherCliTest extends TestUtil.ScalaCliSuite {
11-
1211
test("resolve nightly version".flaky) {
1312
val logger = TestLogger()
1413
val cache = CoursierOptions().coursierCache(logger.coursierLogger(""))
@@ -19,7 +18,7 @@ class LauncherCliTest extends TestUtil.ScalaCliSuite {
1918
expect(nightlyCliVersion.endsWith("-SNAPSHOT"))
2019
}
2120

22-
val expectedScalaCliVersions = Seq(
21+
val expectedScalaCliVersions: Seq[(String, String)] = Seq(
2322
"0.1.2" -> Constants.defaultScala212Version,
2423
"0.1.1+43-g15666b67-SNAPSHOT" -> Constants.defaultScala212Version,
2524
"0.1.3" -> Constants.defaultScala213Version,
@@ -29,8 +28,6 @@ class LauncherCliTest extends TestUtil.ScalaCliSuite {
2928
for ((cliVersion, expectedScalaVersion) <- expectedScalaCliVersions)
3029
test(s"use expected scala version for Scala CLI launcher: $cliVersion") {
3130
val scalaVersion = LauncherCli.scalaCliScalaVersion(cliVersion)
32-
3331
expect(scalaVersion == expectedScalaVersion)
3432
}
35-
3633
}

modules/cli/src/test/scala/cli/tests/OptionsCheck.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import scala.cli.ScalaCliCommands
66
import scala.cli.commands.shared.HasGlobalOptions
77

88
class OptionsCheck extends TestUtil.ScalaCliSuite {
9-
for (
10-
command <-
11-
new ScalaCliCommands("scala-cli", "scala-cli", "Scala CLI").commands
12-
)
9+
for (command <- new ScalaCliCommands("scala-cli", "scala-cli", "Scala CLI").commands)
1310
test(s"No duplicated options in ${command.names.head.mkString(" ")}") {
1411
command.ensureNoDuplicates()
1512
}

modules/cli/src/test/scala/cli/tests/PackageTests.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package cli.tests
22

3+
import bloop.rifle.BloopRifleConfig
34
import com.eed3si9n.expecty.Expecty.expect
45

56
import java.nio.file.FileSystems
6-
77
import scala.build.Ops.*
88
import scala.build.options.{BuildOptions, InternalOptions, PackageType}
99
import scala.build.tests.util.BloopServer
@@ -13,11 +13,11 @@ import scala.cli.commands.package0.Package
1313
import scala.cli.packaging.Library
1414

1515
class PackageTests extends TestUtil.ScalaCliSuite {
16-
val buildThreads = BuildThreads.create()
17-
def bloopConfig = BloopServer.bloopConfig
16+
val buildThreads: BuildThreads = BuildThreads.create()
17+
def bloopConfig: BloopRifleConfig = BloopServer.bloopConfig
1818

19-
val extraRepoTmpDir = os.temp.dir(prefix = "scala-cli-tests-extra-repo-")
20-
val directories = Directories.under(extraRepoTmpDir)
19+
val extraRepoTmpDir: os.Path = os.temp.dir(prefix = "scala-cli-tests-extra-repo-")
20+
val directories: Directories = Directories.under(extraRepoTmpDir)
2121

2222
val defaultOptions = BuildOptions(
2323
internal = InternalOptions(
@@ -92,5 +92,4 @@ class PackageTests extends TestUtil.ScalaCliSuite {
9292
expect(packageType == PackageType.Native.Application)
9393
}
9494
}
95-
9695
}

modules/cli/src/test/scala/cli/tests/TestUtil.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package cli.tests
22

33
import coursier.cache.{ArtifactError, FileCache}
44
import coursier.util.{Artifact, Task}
5+
import munit.AnyFixture
56

67
import java.io.File
78
import java.util.concurrent.TimeUnit
8-
99
import scala.concurrent.duration.{DurationInt, FiniteDuration}
1010
import scala.util.control.NonFatal
1111

@@ -23,7 +23,7 @@ object TestUtil {
2323

2424
override def munitTimeout = new FiniteDuration(120, TimeUnit.SECONDS)
2525

26-
val testStartEndLogger = new Fixture[Unit]("files") {
26+
val testStartEndLogger: Fixture[Unit] = new Fixture[Unit]("files") {
2727
def apply(): Unit = ()
2828

2929
override def beforeEach(context: BeforeEach): Unit = {
@@ -41,7 +41,7 @@ object TestUtil {
4141
}
4242
}
4343

44-
override def munitFixtures = List(testStartEndLogger)
44+
override def munitFixtures: Seq[AnyFixture[?]] = List(testStartEndLogger)
4545
}
4646

4747
def downloadFile(url: String): Either[ArtifactError, Array[Byte]] = {

modules/options/src/test/scala/scala/build/options/ConfigMonoidTest.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,5 @@ class ConfigMonoidTest extends munit.FunSuite {
5151

5252
assertEquals(Outer.monoid.orElse(outer1, outer2).name, Some("o1"))
5353
assertEquals(Outer.monoid.orElse(outer2, outer1).name, Some("o2"))
54-
5554
}
5655
}

0 commit comments

Comments
 (0)