Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagrams.assert calls Future two times #2218

Open
antarcticer opened this issue Dec 19, 2022 · 1 comment
Open

Diagrams.assert calls Future two times #2218

antarcticer opened this issue Dec 19, 2022 · 1 comment

Comments

@antarcticer
Copy link

One line assert from org.scalatest.diagrams.Diagrams calls Future two times:

import org.scalatest.diagrams.Diagrams
import org.scalatest.funsuite.AnyFunSuite
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.{Duration, SECONDS}
import scala.concurrent.{Await, Future}

class ReproduceTest extends AnyFunSuite with Diagrams {
  test("reproduce") {
    assert(Await.result(Future { println("in future"); 42 }, Duration(1, SECONDS)) == 42)
  }
}

result:

in future
in future

Two line assert is ok:

    assert(Await.result(Future { println("in future"); 42 },
      Duration(1, SECONDS)) == 42)

result:

in future

Checked versions:

  • scalatest 3.2.12, scala 2.13.7
  • scalatest 3.2.14, scala 3.2.1
@cheeseng
Copy link
Contributor

@antarcticer Fyi I submitted the following PR for this:

#2219

If it is approved by @bvenners , we can include this in the upcoming 3.2.15 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants