summaryrefslogtreecommitdiff
path: root/scalajslib
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-04 10:13:07 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-04 10:13:07 -0800
commitce0a5c2869da538b79d6adb9e28dd46741953889 (patch)
tree7baaa6120421dbf6f9eccd1831b3229b994a9269 /scalajslib
parent54546198dc0a449a7a3f0c6f34e65d06747f37bd (diff)
downloadmill-ce0a5c2869da538b79d6adb9e28dd46741953889.tar.gz
mill-ce0a5c2869da538b79d6adb9e28dd46741953889.tar.bz2
mill-ce0a5c2869da538b79d6adb9e28dd46741953889.zip
Fix `HelloJsWorld` tests
Diffstat (limited to 'scalajslib')
-rw-r--r--scalajslib/src/mill/scalajslib/ScalaJSModule.scala5
-rw-r--r--scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala63
2 files changed, 34 insertions, 34 deletions
diff --git a/scalajslib/src/mill/scalajslib/ScalaJSModule.scala b/scalajslib/src/mill/scalajslib/ScalaJSModule.scala
index 7b6b79f9..70ae1394 100644
--- a/scalajslib/src/mill/scalajslib/ScalaJSModule.scala
+++ b/scalajslib/src/mill/scalajslib/ScalaJSModule.scala
@@ -128,8 +128,9 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer =>
else scalaJSBinaryVersion()
}
- override def artifactId: T[String] = T { s"${artifactName()}_sjs${artifactScalaJSVersion()}_${artifactScalaVersion()}" }
-
+ override def artifactSuffix: T[String] = T {
+ s"_sjs${artifactScalaJSVersion()}_${artifactScalaVersion()}"
+ }
}
trait TestScalaJSModule extends ScalaJSModule with TestModule {
diff --git a/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala b/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala
index c9ab64e1..cc44b7c8 100644
--- a/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala
+++ b/scalajslib/test/src/mill/scalajslib/HelloJSWorldTests.scala
@@ -7,7 +7,7 @@ import javax.script.{ScriptContext, ScriptEngineManager}
import ammonite.ops._
import mill._
import mill.define.Discover
-import mill.scalalib.{DepSyntax, Lib, PublishModule, TestRunner}
+import mill.scalalib.{CrossScalaModule, DepSyntax, Lib, PublishModule, TestRunner}
import mill.scalalib.publish.{Developer, License, PomSettings, SCM}
import mill.util.{TestEvaluator, TestUtil}
import utest._
@@ -19,7 +19,7 @@ import scala.collection.JavaConverters._
object HelloJSWorldTests extends TestSuite {
val workspacePath = TestUtil.getOutPathStatic() / "hello-js-world"
- trait HelloJSWorldModule extends ScalaJSModule with PublishModule {
+ trait HelloJSWorldModule extends ScalaJSModule with PublishModule with CrossScalaModule{
override def millSourcePath = workspacePath
def publishVersion = "0.0.1-SNAPSHOT"
override def mainClass = Some("Main")
@@ -31,11 +31,29 @@ object HelloJSWorldTests extends TestSuite {
scalaJS <- Seq("0.6.22", "1.0.0-M2")
} yield (scala, scalaJS)
- object build extends Cross[BuildModule](matrix:_*)
+ object helloJsWorld extends Cross[BuildModule](matrix:_*)
+ class BuildModule(val crossScalaVersion: String, sjsVersion0: String) extends HelloJSWorldModule {
+ override def artifactName = "hello-js-world"
+ def scalaJSVersion = sjsVersion0
+ def pomSettings = PomSettings(
+ organization = "com.lihaoyi",
+ description = "hello js world ready for real world publishing",
+ url = "https://github.com/lihaoyi/hello-world-publish",
+ licenses = Seq(
+ License("Apache License, Version 2.0",
+ "http://www.apache.org/licenses/LICENSE-2.0")),
+ scm = SCM(
+ "https://github.com/lihaoyi/hello-world-publish",
+ "scm:git:https://github.com/lihaoyi/hello-world-publish"
+ ),
+ developers =
+ Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi"))
+ )
+ }
object buildUTest extends Cross[BuildModuleUtest](matrix:_*)
- class BuildModuleUtest(scalaVersion0: String, sjsVersion0: String)
- extends BuildModule(scalaVersion0: String, sjsVersion0: String) {
+ class BuildModuleUtest(crossScalaVersion: String, sjsVersion0: String)
+ extends BuildModule(crossScalaVersion, sjsVersion0) {
object test extends super.Tests {
override def sources = T.sources{ millSourcePath / 'src / 'utest }
def testFramework: T[String] = "utest.runner.Framework"
@@ -46,8 +64,8 @@ object HelloJSWorldTests extends TestSuite {
}
object buildScalaTest extends Cross[BuildModuleScalaTest](matrix:_*)
- class BuildModuleScalaTest(scalaVersion0: String, sjsVersion0: String)
- extends BuildModule(scalaVersion0: String, sjsVersion0: String) {
+ class BuildModuleScalaTest(crossScalaVersion: String, sjsVersion0: String)
+ extends BuildModule(crossScalaVersion, sjsVersion0) {
object test extends super.Tests {
override def sources = T.sources{ millSourcePath / 'src / 'scalatest }
def testFramework: T[String] = "org.scalatest.tools.Framework"
@@ -56,25 +74,6 @@ object HelloJSWorldTests extends TestSuite {
)
}
}
-
- class BuildModule(scalaVersion0: String, sjsVersion0: String) extends HelloJSWorldModule {
- def scalaVersion = scalaVersion0
- def scalaJSVersion = sjsVersion0
- def pomSettings = PomSettings(
- organization = "com.lihaoyi",
- description = "hello js world ready for real world publishing",
- url = "https://github.com/lihaoyi/hello-world-publish",
- licenses = Seq(
- License("Apache License, Version 2.0",
- "http://www.apache.org/licenses/LICENSE-2.0")),
- scm = SCM(
- "https://github.com/lihaoyi/hello-world-publish",
- "scm:git:https://github.com/lihaoyi/hello-world-publish"
- ),
- developers =
- Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi"))
- )
- }
}
val millSourcePath = pwd / 'scalajslib / 'test / 'resources / "hello-js-world"
@@ -105,7 +104,7 @@ object HelloJSWorldTests extends TestSuite {
def testCompileFromScratch(scalaVersion: String,
scalaJSVersion: String): Unit = {
val Right((result, evalCount)) =
- helloWorldEvaluator(HelloJSWorld.build(scalaVersion, scalaJSVersion).compile)
+ helloWorldEvaluator(HelloJSWorld.helloJsWorld(scalaVersion, scalaJSVersion).compile)
val outPath = result.classes.path
val outputFiles = ls.rec(outPath)
@@ -117,7 +116,7 @@ object HelloJSWorldTests extends TestSuite {
// don't recompile if nothing changed
val Right((_, unchangedEvalCount)) =
- helloWorldEvaluator(HelloJSWorld.build(scalaVersion, scalaJSVersion).compile)
+ helloWorldEvaluator(HelloJSWorld.helloJsWorld(scalaVersion, scalaJSVersion).compile)
assert(unchangedEvalCount == 0)
}
@@ -131,8 +130,8 @@ object HelloJSWorldTests extends TestSuite {
scalaJSVersion: String,
mode: OptimizeMode): Unit = {
val task = mode match {
- case FullOpt => HelloJSWorld.build(scalaVersion, scalaJSVersion).fullOpt
- case FastOpt => HelloJSWorld.build(scalaVersion, scalaJSVersion).fastOpt
+ case FullOpt => HelloJSWorld.helloJsWorld(scalaVersion, scalaJSVersion).fullOpt
+ case FastOpt => HelloJSWorld.helloJsWorld(scalaVersion, scalaJSVersion).fastOpt
}
val Right((result, evalCount)) = helloWorldEvaluator(task)
val output = runJS(result.path)
@@ -153,7 +152,7 @@ object HelloJSWorldTests extends TestSuite {
}
'jar - {
'containsSJSIRs - {
- val Right((result, evalCount)) = helloWorldEvaluator(HelloJSWorld.build("2.12.4", "0.6.22").jar)
+ val Right((result, evalCount)) = helloWorldEvaluator(HelloJSWorld.helloJsWorld("2.12.4", "0.6.22").jar)
val jar = result.path
val entries = new JarFile(jar.toIO).entries().asScala.map(_.getName)
assert(entries.contains("Main$.sjsir"))
@@ -163,7 +162,7 @@ object HelloJSWorldTests extends TestSuite {
def testArtifactId(scalaVersion: String,
scalaJSVersion: String,
artifactId: String): Unit = {
- val Right((result, evalCount)) = helloWorldEvaluator(HelloJSWorld.build(scalaVersion, scalaJSVersion).artifact)
+ val Right((result, evalCount)) = helloWorldEvaluator(HelloJSWorld.helloJsWorld(scalaVersion, scalaJSVersion).artifact)
assert(result.id == artifactId)
}
'artifactId_0621 - testArtifactId("2.12.4", "0.6.22", "hello-js-world_sjs0.6_2.12")