-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle assume(false) correctly (#629)
* Handle assume(false) correctly `assume(false)` gets now handled in the same way as `test("description".ignore")`. Added tests to cover both ways to skip tests. * align behaviour on all 3 platforms * scalafmt
- Loading branch information
Showing
5 changed files
with
33 additions
and
3 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
3 changes: 2 additions & 1 deletion
3
munit/native/src/main/scala/org/junit/AssumptionViolatedException.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package org.junit | ||
|
||
class AssumptionViolatedException(message: String) extends RuntimeException | ||
class AssumptionViolatedException(message: String) | ||
extends RuntimeException(message) |
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
27 changes: 27 additions & 0 deletions
27
tests/shared/src/main/scala/munit/SkippedFrameworkSuite.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,27 @@ | ||
package munit | ||
|
||
class SkippedFrameworkSuite extends FunSuite { | ||
test("pass") { | ||
// println("pass") | ||
} | ||
test("ignore".ignore) { | ||
??? | ||
} | ||
test("assume(true)") { | ||
assume(true, "assume it passes") | ||
// println("pass") | ||
} | ||
test("assume(false)") { | ||
assume(false, "assume it fails") | ||
} | ||
} | ||
|
||
object SkippedFrameworkSuite | ||
extends FrameworkTest( | ||
classOf[SkippedFrameworkSuite], | ||
"""|==> success munit.SkippedFrameworkSuite.pass | ||
|==> ignored munit.SkippedFrameworkSuite.ignore | ||
|==> success munit.SkippedFrameworkSuite.assume(true) | ||
|==> skipped munit.SkippedFrameworkSuite.assume(false) - assume it fails | ||
|""".stripMargin | ||
) |
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