forked from scalameta/munit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The bug appears to be fixed with the recent changes to async fixtures.
- Loading branch information
Showing
6 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/shared/src/main/scala/munit/Issue285FrameworkSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package munit | ||
|
||
import scala.concurrent.duration.Duration | ||
import munit.internal.PlatformCompat | ||
import scala.concurrent.Promise | ||
|
||
class Issue285FrameworkSuite extends FunSuite { | ||
def println(msg: String): Unit = TestingConsole.out.println(msg) | ||
val hello = new Fixture[Unit]("hello") { | ||
def apply(): Unit = () | ||
override def beforeAll(): Unit = { | ||
println("beforeAll") | ||
} | ||
override def beforeEach(context: BeforeEach): Unit = { | ||
println("beforeEach - " + context.test.name) | ||
} | ||
override def afterEach(context: AfterEach): Unit = { | ||
println("afterEach - " + context.test.name) | ||
} | ||
override def afterAll(): Unit = { | ||
println("afterAll") | ||
} | ||
} | ||
override def munitFixtures = List(hello) | ||
override def munitTimeout: Duration = Duration(1, "ms") | ||
test("issue-285-ok") { | ||
() | ||
} | ||
test("issue-285-fail") { | ||
val promise = Promise[Unit]() | ||
PlatformCompat.setTimeout(3) { | ||
promise.trySuccess(()) | ||
} | ||
promise.future | ||
} | ||
test("issue-285-ok") { | ||
() | ||
} | ||
} | ||
|
||
object Issue285FrameworkSuite | ||
extends FrameworkTest( | ||
classOf[Issue285FrameworkSuite], | ||
"""|munit.Issue285FrameworkSuite: | ||
|beforeAll | ||
|beforeEach - issue-285-ok | ||
|afterEach - issue-285-ok | ||
| + issue-285-ok <elapsed time> | ||
|beforeEach - issue-285-fail | ||
|afterEach - issue-285-fail | ||
|==> X munit.Issue285FrameworkSuite.issue-285-fail <elapsed time>java.util.concurrent.TimeoutException: test timed out after 1 millisecond | ||
|beforeEach - issue-285-ok | ||
|afterEach - issue-285-ok | ||
| + issue-285-ok-1 <elapsed time> | ||
|afterAll | ||
|""".stripMargin, | ||
format = StdoutFormat | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters