Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal/catch_assertionhandler.cpp
diff options
context:
space:
mode:
authorPhil Nash2017-08-08 20:17:09 +0100
committerPhil Nash2017-08-08 20:17:09 +0100
commit5f9172436883c535de4a119bd3b2314a2a5f9f70 (patch)
tree2d269fc614eb3418e8100fa4bfd636fef6149edb /include/internal/catch_assertionhandler.cpp
parent8a97beece21ac02ba71b03fe33f5ccaba36ff4c0 (diff)
downloadcatch3-5f9172436883c535de4a119bd3b2314a2a5f9f70.tar.gz
integrated AssertionHandler into INTERNAL_CATCH_MSG
Diffstat (limited to 'include/internal/catch_assertionhandler.cpp')
-rw-r--r--include/internal/catch_assertionhandler.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp
index fe8e32a0..d53b09fa 100644
--- a/include/internal/catch_assertionhandler.cpp
+++ b/include/internal/catch_assertionhandler.cpp
@@ -59,8 +59,22 @@ namespace Catch {
getCurrentContext().getResultCapture()->assertionStarting( m_assertionInfo );
}
- void AssertionHandler::handle( ResultWas::OfType resultType, ITransientExpression const* expr, bool negated ) {
+ void AssertionHandler::handle( ITransientExpression const& expr ) {
+ bool negated = isFalseTest( m_assertionInfo.resultDisposition );
+ bool result = expr.getResult() != negated;
+
+ handle( result ? ResultWas::Ok : ResultWas::ExpressionFailed, &expr, negated );
+ }
+ void AssertionHandler::handle( ResultWas::OfType resultType ) {
+ handle( resultType, nullptr, false );
+ }
+ void AssertionHandler::handle( ResultWas::OfType resultType, StringRef const& message ) {
+ AssertionResultData data( resultType, LazyExpression( false ) );
+ data.message = message.c_str();
+ handle( data, nullptr );
+ }
+ void AssertionHandler::handle( ResultWas::OfType resultType, ITransientExpression const* expr, bool negated ) {
AssertionResultData data( resultType, LazyExpression( negated ) );
handle( data, expr );
}
@@ -80,16 +94,7 @@ namespace Catch {
(m_assertionInfo.resultDisposition & ResultDisposition::Normal);
}
}
- void AssertionHandler::handle( ITransientExpression const& expr ) {
-
- bool negated = isFalseTest( m_assertionInfo.resultDisposition );
- bool result = expr.getResult() != negated;
- handle( result ? ResultWas::Ok : ResultWas::ExpressionFailed, &expr, negated );
- }
- void AssertionHandler::handle( ResultWas::OfType resultType ) {
- handle( resultType, nullptr, false );
- }
auto AssertionHandler::allowThrows() const -> bool {
return getCurrentContext().getConfig()->allowThrows();
}
@@ -117,12 +122,7 @@ namespace Catch {
useActiveException();
}
void AssertionHandler::useActiveException() {
- bool negated = isFalseTest( m_assertionInfo.resultDisposition );
-
- AssertionResultData data( ResultWas::ThrewException, LazyExpression( negated ) );
- data.message = Catch::translateActiveException();
-
- handle( data, nullptr );
+ handle( ResultWas::ThrewException, Catch::translateActiveException().c_str() );
}
} // namespace Catch