-
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.
Merge pull request #59 from daron666/add-fail-suite-helper
Add failSuite() helper to abort the entire test suite
- Loading branch information
Showing
5 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package munit | ||
|
||
class FailSuiteException( | ||
override val message: String, | ||
override val location: Location | ||
) extends FailException(message, location) |
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
25 changes: 25 additions & 0 deletions
25
tests/shared/src/main/scala/munit/FailSuiteFrameworkSuite.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,25 @@ | ||
package munit | ||
|
||
class FailSuiteFrameworkSuite extends FunSuite { | ||
test("pass") { | ||
// println("pass") | ||
} | ||
test("fail") { | ||
failSuite("Oops, can not do anything.") | ||
} | ||
test(name = "not gonna run") { | ||
// println("not pass") | ||
} | ||
} | ||
|
||
object FailSuiteFrameworkSuite | ||
extends FrameworkTest( | ||
classOf[FailSuiteFrameworkSuite], | ||
"""|==> success munit.FailSuiteFrameworkSuite.pass | ||
|==> failure munit.FailSuiteFrameworkSuite.fail - /scala/munit/FailSuiteFrameworkSuite.scala:8 Oops, can not do anything. | ||
|7: test("fail") { | ||
|8: failSuite("Oops, can not do anything.") | ||
|9: } | ||
|==> skipped munit.FailSuiteFrameworkSuite.not gonna run - Suite has been aborted | ||
|""".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