Skip to content

Commit

Permalink
Slightly updated scalalib test, use shared scala versions (#2049)
Browse files Browse the repository at this point in the history
Pull request: #2049
  • Loading branch information
lefou authored Sep 29, 2022
1 parent c9c409e commit 203f2e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
2 changes: 2 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ object Deps {
val testScala213Version = "2.13.8"
val testScala212Version = "2.12.6"
val testScala211Version = "2.11.12"
val testScala210Version = "2.10.6"
val testScala30Version = "3.0.2"
val testScala31Version = "3.1.3"
val testScala32Version = "3.2.0"
Expand Down Expand Up @@ -302,6 +303,7 @@ trait MillScalaModule extends ScalaModule with MillCoursierModule { outer =>
s"-DTEST_SCALA_2_13_VERSION=${Deps.testScala213Version}",
s"-DTEST_SCALA_2_12_VERSION=${Deps.testScala212Version}",
s"-DTEST_SCALA_2_11_VERSION=${Deps.testScala211Version}",
s"-DTEST_SCALA_2_10_VERSION=${Deps.testScala210Version}",
s"-DTEST_SCALA_3_0_VERSION=${Deps.testScala30Version}",
s"-DTEST_SCALA_3_1_VERSION=${Deps.testScala31Version}",
s"-DTEST_SCALA_3_2_VERSION=${Deps.testScala32Version}",
Expand Down
48 changes: 24 additions & 24 deletions scalalib/test/src/HelloWorldTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ import utest.framework.TestPath

object HelloWorldTests extends TestSuite {

val scala2106Version = "2.10.6"
val scala21111Version = "2.11.11"
val scala210Version = sys.props.getOrElse("TEST_SCALA_2_10_VERSION", ???)
val scala211Version = sys.props.getOrElse("TEST_SCALA_2_11_VERSION", ???)
val scala2123Version = "2.12.3"
val scala2126Version = "2.12.6"
val scala2131Version = "2.13.1"
val scala212Version = sys.props.getOrElse("TEST_SCALA_2_12_VERSION", ???)
val scala213Version = sys.props.getOrElse("TEST_SCALA_2_13_VERSION", ???)

trait HelloBase extends TestUtil.BaseModule {
override def millSourcePath: os.Path =
TestUtil.getSrcPathBase() / millOuterCtx.enclosing.split('.')
}

trait HelloWorldModule extends scalalib.ScalaModule {
def scalaVersion = scala2126Version
def scalaVersion = scala212Version
}

trait HelloWorldModuleWithMain extends HelloWorldModule {
Expand All @@ -41,11 +41,11 @@ object HelloWorldTests extends TestSuite {
}
object CrossHelloWorld extends HelloBase {
object core extends Cross[HelloWorldCross](
scala2106Version,
scala21111Version,
scala210Version,
scala211Version,
scala2123Version,
scala2126Version,
scala2131Version
scala212Version,
scala213Version
)
class HelloWorldCross(val crossScalaVersion: String) extends CrossScalaModule
}
Expand Down Expand Up @@ -207,7 +207,7 @@ object HelloWorldTests extends TestSuite {

object HelloWorldScalaOverride extends HelloBase {
object core extends HelloWorldModule {
override def scalaVersion: Target[String] = scala2131Version
override def scalaVersion: Target[String] = scala213Version
}
}

Expand Down Expand Up @@ -241,7 +241,7 @@ object HelloWorldTests extends TestSuite {

object HelloWorldMacros extends HelloBase {
object core extends ScalaModule {
def scalaVersion = scala2126Version
def scalaVersion = scala212Version

override def ivyDeps = Agg(
ivy"com.github.julien-truffaut::monocle-macro::1.4.0"
Expand All @@ -254,7 +254,7 @@ object HelloWorldTests extends TestSuite {

object HelloWorldFlags extends HelloBase {
object core extends ScalaModule {
def scalaVersion = scala2126Version
def scalaVersion = scala212Version

override def scalacOptions = super.scalacOptions() ++ Seq(
"-Ypartial-unification"
Expand All @@ -264,7 +264,7 @@ object HelloWorldTests extends TestSuite {

object HelloScalacheck extends HelloBase {
object foo extends ScalaModule {
def scalaVersion = scala2126Version
def scalaVersion = scala212Version
object test extends Tests {
override def ivyDeps = Agg(ivy"org.scalacheck::scalacheck:1.13.5")
override def testFramework = "org.scalacheck.ScalaCheckFramework"
Expand Down Expand Up @@ -340,15 +340,15 @@ object HelloWorldTests extends TestSuite {
val Right((result, evalCount)) = eval.apply(HelloWorld.core.scalaVersion)

assert(
result == scala2126Version,
result == scala212Version,
evalCount > 0
)
}
"override" - workspaceTest(HelloWorldScalaOverride) { eval =>
val Right((result, evalCount)) = eval.apply(HelloWorldScalaOverride.core.scalaVersion)

assert(
result == scala2131Version,
result == scala213Version,
evalCount > 0
)
}
Expand Down Expand Up @@ -509,7 +509,7 @@ object HelloWorldTests extends TestSuite {
"artifactNameCross" - {
workspaceTest(CrossHelloWorld) { eval =>
val Right((artifactName, _)) =
eval.apply(CrossHelloWorld.core(scala2131Version).artifactName)
eval.apply(CrossHelloWorld.core(scala213Version).artifactName)
assert(artifactName == "core")
}
}
Expand Down Expand Up @@ -545,15 +545,15 @@ object HelloWorldTests extends TestSuite {
"v210" - TestUtil.disableInJava9OrAbove("Scala 2.10 tests don't work with Java 9+")(
workspaceTest(CrossHelloWorld)(cross(
_,
scala2106Version,
s"${scala2106Version} rox"
scala210Version,
s"${scala210Version} rox"
))
)
"v211" - TestUtil.disableInJava9OrAbove("Scala 2.11 tests don't work with Java 9+")(
workspaceTest(CrossHelloWorld)(cross(
_,
scala21111Version,
s"${scala21111Version} pwns"
scala211Version,
s"${scala211Version} pwns"
))
)
"v2123" - workspaceTest(CrossHelloWorld)(cross(
Expand All @@ -563,13 +563,13 @@ object HelloWorldTests extends TestSuite {
))
"v2124" - workspaceTest(CrossHelloWorld)(cross(
_,
scala2126Version,
s"${scala2126Version} leet"
scala212Version,
s"${scala212Version} leet"
))
"v2131" - workspaceTest(CrossHelloWorld)(cross(
_,
scala2131Version,
s"${scala2131Version} idk"
scala213Version,
s"${scala213Version} idk"
))
}

Expand Down

0 comments on commit 203f2e8

Please sign in to comment.