utest
utest copied to clipboard
Compiler warning when using TestPath implicits as shown in Doc
With scala 2.13.5 I'm getting compiler warnings when using the TestPath implicit. That's new after an update from scala 2.12.x.
[warn] /Users/bwbecker/oat/src/oatlibxp/oatlibxp/src/test/scala/oatLibXP/verify/ImplicitTest.scala:13:21: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): Implicit conversions from Array to immutable.IndexedSeq are implemented by copying; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call
[warn] val tests = Tests {
[warn] ^
[warn] /Users/bwbecker/oat/src/oatlibxp/oatlibxp/src/test/scala/oatLibXP/verify/ImplicitTest.scala:27:21: method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): Implicit conversions from Array to immutable.IndexedSeq are implemented by copying; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call
[warn] val tests = Tests {
[warn] ^
[warn] two warnings found
--------- Running Tests oatLibXP.verify.{ImplicitTest1,ImplicitTest2} ---------
--------- Running Tests oatLibXP.verify.{ImplicitTest1,ImplicitTest2} ---------
+ oatLibXP.verify.ImplicitTest1.causes a compiler warning 3ms
+ oatLibXP.verify.ImplicitTest2.causes a compiler warning 3ms
[info] Tests: 2, Passed: 2, Failed: 0
[success] Total time: 1 s, completed Mar. 4, 2021, 2:14:26 p.m.
Here's the code:
package oatLibXP.verify
import utest._
import utest.framework.TestPath
object ImplicitTest1 extends TestSuite {
def f(x: Int)(implicit testPath: TestPath): Unit = {
testPath.value.mkString(" ") ==> "causes a compiler warning"
x ==> 42
}
val tests = Tests {
test("causes a compiler warning") {
f(42)
}
}
}
object ImplicitTest2 extends TestSuite {
def g(x: Int, testPath: TestPath): Unit = {
testPath.value.mkString(" ") ==> "causes a compiler warning"
x ==> 42
}
val tests = Tests {
test("causes a compiler warning") {
g(42, implicitly[TestPath])
}
}
}
Also, the TestPath
section of the Docs uses the now deprecated "test description" - { ... }
format.