diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/ThrownExpectations.scala b/matcher/shared/src/main/scala/org/specs2/matcher/ThrownExpectations.scala index 09ba1e868..de2657afc 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/ThrownExpectations.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/ThrownExpectations.scala @@ -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) @@ -77,7 +78,7 @@ trait ThrownExpectables extends ExpectationsCreation { r } - /** this method can be overriden to throw exceptions when checking the match result */ + /** this method can be overridden to throw exceptions when checking the match result */ override protected def checkMatchResultFailure[T](m: MatchResult[T]) = { m match { case f@MatchFailure(_, _, _, _, _) => throw new MatchFailureException(f) diff --git a/tests/src/test/scala/org/specs2/matcher/MatchResultCombinatorsSpec.scala b/tests/src/test/scala/org/specs2/matcher/MatchResultCombinatorsSpec.scala index 50dac240c..3de188a00 100644 --- a/tests/src/test/scala/org/specs2/matcher/MatchResultCombinatorsSpec.scala +++ b/tests/src/test/scala/org/specs2/matcher/MatchResultCombinatorsSpec.scala @@ -85,4 +85,9 @@ 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] + } }