lazy val foos = project.settings(
moduleName := "scalafix",
resolvers ++= Seq(
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
Resolver.sonatypeRepo("releases")
),
libraryDependencies ++= Seq(
"com.lihaoyi" %% "utest" % "0.6.8" % "test"
),
testFrameworks += new TestFramework("utest.runner.Framework")
)
test("test3") { ... }
.
Tracer
and Assertions
macros.Hey, I'm trying to use utest in my dotty project, which I build with mill. My build file is quite simple:
object main extends ScalaModule {
def scalaVersion = "0.24.0-RC1"
object test extends Tests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.4".withDottyCompat(scalaVersion()))
def testFrameworks = Seq("utest.runner.Framework")
}
}
When I try to run tests, however, it is complaining that Scala 2 macros cannot be used in dotty (coming from the Tests {
).
I saw that the code for Tests
depends on the version of scala and I suspect that in my case the code for scala 2.13 is being pulled in rather than the one for dotty.
How can I use utest in dotty?
Is there a way to test along the lines of this?:
import scalatags.JsDom.all._
import utest._
object HtmlTest extends TestSuite {
val tests = Tests {
test("html") {
val page = html(body("Hello World")).render
page.firstChild.textContent ==> "Hello World"
}
}
}
The above test gives me java.lang.Error: stub
match
expressions within an eventually
function? I'm using 0.6.9, but I've also tried the 0.7 releases. I see the compiler blow up:[error] during phase: typer
[error] library version: version 2.12.10
[error] compiler version: version 2.12.10
[error] reconstructed args: ...
[error]
[error] last tree to typer: UnApply
[error] tree position: line 215 of EndDeviceServiceTest.scala
[error] symbol: null
[error] call site: object EndDeviceServiceTest in package controlcenter in package controlcenter
[error]
[error] == Source file context for tree position ==
[error]
[error] 212 val expectedPosition = LatLng(-20, 20, None)
[error] 213
[error] 214 events match {
[error] 215 case Seq(
[error] 216 Snapshots.StoredEvent(
[error] 217 EndDeviceEvents.NameUpdated(1, "some-name")),
[error] 218 Snapshots.StoredEvent(EndDeviceEvents.SecretsUpdated(1, _)),
test("whatever") /* this part --> */{ ... } /* <-- */
with the error 'Any' does not take parameters
. Everything compiles fine, and I can even run the test from IntelliJ, so I guess it's an IntelliJ bug, but is there some way to let IntelliJ know what's going on so it doesn't show an error?
./mill -i -D dottyVersion="<version>" utest.jvm[<version>].publishLocal
test - method should only be used directly inside a Tests{} macro
error.