Hello,
I鈥榤 experiencing a strange bug with the Artima SuperSafe community edition, it is throwing an error when trying to check if a collection is non-empty using matchers.
To illustrate the problem, I will provide a dummy tests class.
import org.scalatest.{FlatSpec, Matchers}
import org.scalactic.TypeCheckedTripleEquals
class SuperSafeSpec extends FlatSpec with TypeCheckedTripleEquals with Matchers {
behavior of "Artima SuperSafe Scala compiler"
//this works
it should "allow the compilation of this tests" in {
List.empty[Int] shouldBe empty
}
//this does not work
it should "allow the compiltion of this tests too" in {
List(1, 2, 3) should not be empty
}
}
The second tests will no compile with the following error
[error] /src/test/scala/SuperSafeSpec.scala:14:30: [Artima SuperSafe] Values of type List[Int] and org.scalatest.enablers.Emptiness[scala.collection.GenTraversable[Int]] may not be compared for equality with ScalaTest's not be matcher syntax. If you really want this expression to compile, configure Artima SuperSafe to allow List[Int] and org.scalatest.enablers.Emptiness[scala.collection.GenTraversable[Int]] to be compared for equality. For more information on this kind of error, see: http://www.artima.com/supersafe_user_guide.html#safer-equality
[error] List(1, 2, 3) should not be empty
I know I can just configure the plugin to allow this check, but this should be the normal behavior of it.
Update
I noticed that it is also failing when checking if an option is defined.
val option: Option[Int] = Some(1)
option shouldBe defined
[Artima SuperSafe] Values of type Option[Int] and org.scalatest.enablers.Definition[Option[Int]] may not be compared for equality with ScalaTest's shouldBe matcher syntax. (...)
I'll look into this now.
@BalmungSan A quick update, we're testing the fix, expecting to release the fix early next week.
@cheeseng Thank you very much!
@BalmungSan SuperSafe CE version 1.1.5 published last week should fix this, please close this ticket after you verify the fix, thank you.
@cheeseng Thanks, I'll verify it in a couple of hours.
UPDATE:
All worked as expected. :+1:
Most helpful comment
@BalmungSan SuperSafe CE version 1.1.5 published last week should fix this, please close this ticket after you verify the fix, thank you.