Skip to content

Commit

Permalink
fix: issue #1255 rethrow a failure exception for ok and failure
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Jul 4, 2024
1 parent 963c6c0 commit 65ce08e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ trait ThrownExpectables extends ExpectationsCreation {
// overriding this method is necessary to include the ThrownExpectation trait into the stacktrace of the created match result
override def applyMatcher[S >: T](m: =>Matcher[S]): MatchResult[S] = super.applyMatcher(m)
override def check[S >: T](r: MatchResult[S]): MatchResult[S] = checkFailure(r)
override def checkResult(r: Result): Result = checkResultFailure(r)
override val desc = alias
override def map[S](f: T => S): Expectable[S] = createExpectable(f(value), desc)
override def mapDescription(d: Option[String => String]): Expectable[T] = createExpectable(value, d)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,11 @@ class MatchResultCombinatorsSpec extends mutable.Spec with ResultMatchers with M
"there is only one stored expectation (see #320)" ==> { stored must haveSize(1) }
stored.map(_.message).head must_== "'hello world' doesn't have size 10 but size 11"
}

"issue #1255 ok and failure must throw an exception" >> {
new MustThrownExpectations {
ok and failure
} must throwA[execute.FailureException]
}

}
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ThisBuild / version := "4.20.7"
ThisBuild / version := "4.20.8"
ThisBuild / versionScheme := Some("semver-spec")

0 comments on commit 65ce08e

Please sign in to comment.