Skip to content

Commit

Permalink
adopted suggestion from @tgodzik
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuehlke authored and tgodzik committed Apr 16, 2024
1 parent 15f8d41 commit 51a37a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions munit/shared/src/main/scala/munit/Assertions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ trait Assertions extends MacroCompat.CompileErrorMacro {
fail(expectedExceptionMsg)
} catch {
case e: FailExceptionLike[_]
if !T.runtimeClass.isAssignableFrom(e.getClass()) ||
e.getMessage.contains(expectedExceptionMsg) =>
if !T.runtimeClass.isAssignableFrom(e.getClass()) =>
throw e
case e: FailExceptionLike[_]
if e.getMessage.contains(expectedExceptionMsg) =>
throw e
case NonFatal(e) =>
if (T.runtimeClass.isAssignableFrom(e.getClass())) {
Expand Down
2 changes: 1 addition & 1 deletion tests/shared/src/test/scala/munit/FailExceptionSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FailExceptionSuite extends BaseSuite {
assert(clue(e).isInstanceOf[Serializable])
}

test("assertion-error-no-exception") {
test("assertion-error-no-exception") {
try {
intercept[AssertionError] {
println("throwing no exception!")
Expand Down

0 comments on commit 51a37a2

Please sign in to comment.