com-lihaoyi / utest

A simple testing framework for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem when using `eventually`

huntc opened this issue · comments

The following code yields an issue given the use of eventually:

eventually {
  sender ! Udp.Send(data1, address)
  receiver.expectMsgPF() {
    case UdpListener.ReceivedWithReplyTo(Udp.Received(`data1`, _), `listener`) =>
  }
  true
}

The problem reported:

[error] scala.reflect.internal.FatalError: unexpected tree in pattern mode: class scala.reflect.internal.Trees$Block
[error] {
[error]   val $temp$macro$9 = `data1`;
[error]   $log$macro$1(utest.TestValue("`data1`", "akka.util.ByteString", $temp$macro$9));
[error]   $temp$macro$9
[error] }
[error]     at scala.reflect.internal.Reporting.abort(Reporting.scala:61)
[error]     at scala.reflect.internal.Reporting.abort$(Reporting.scala:57)

As @dwijnand suggests:

"probably this code path needs to be a little more selective about what trees it transforms into blocks, it's matching the identifier "data" in the pattern match, that cannot be a block. https://github.com/lihaoyi/utest/blob/v0.6.3/utest/shared/src/main/scala/utest/asserts/Tracer.scala#L34-L65"