-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
96 additions
and
6 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
65 changes: 65 additions & 0 deletions
65
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,65 @@ | ||
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: Fixture[Unit] = 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[Fixture[Unit]] = 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, | ||
tags = Set( | ||
// Skipped on JS/Native because we don't support | ||
// `PlatformCompat.setTimeout` on Native and the test has stack traces | ||
// on JS which fails the assertion (even if the behavior works as | ||
// expected) | ||
OnlyJVM | ||
), | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package munit | ||
|
||
object OnlyJVM extends Tag("OnlyJVm") {} | ||
object OnlyJVM extends Tag("OnlyJVM") {} | ||
object NoDotty extends Tag("NoDotty") {} | ||
object Only213 extends Tag("Only213") {} | ||
object NoNative extends Tag("NoNative") {} |
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