From a7a9ee555213f4f7e7d24070ac9cf064ee82890b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 9 Dec 2017 20:17:47 +0100 Subject: [PATCH] Manual cherry-pick from #1111 This hsould merge still-valid piece of #1111 into master. --- include/internal/catch_assertionhandler.cpp | 5 ----- include/internal/catch_assertionhandler.h | 7 ++++++- include/internal/catch_common.cpp | 4 ---- include/internal/catch_common.h | 5 ++++- include/internal/catch_context.cpp | 2 +- include/internal/catch_context.h | 2 +- include/internal/catch_result_type.cpp | 1 - include/internal/catch_result_type.h | 2 +- 8 files changed, 13 insertions(+), 15 deletions(-) diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp index 4d74dc9c..91899d8f 100644 --- a/include/internal/catch_assertionhandler.cpp +++ b/include/internal/catch_assertionhandler.cpp @@ -59,11 +59,6 @@ namespace Catch { m_resultCapture( getResultCapture() ) {} - AssertionHandler::~AssertionHandler() { - if ( !m_completed ) - m_resultCapture.handleIncomplete( m_assertionInfo ); - } - void AssertionHandler::handleExpr( ITransientExpression const& expr ) { m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); } diff --git a/include/internal/catch_assertionhandler.h b/include/internal/catch_assertionhandler.h index fb51f962..086b5058 100644 --- a/include/internal/catch_assertionhandler.h +++ b/include/internal/catch_assertionhandler.h @@ -52,7 +52,12 @@ namespace Catch { SourceLineInfo const& lineInfo, StringRef capturedExpression, ResultDisposition::Flags resultDisposition ); - ~AssertionHandler(); + ~AssertionHandler() { + if ( !m_completed ) { + m_resultCapture.handleIncomplete( m_assertionInfo ) + } + } + template void handleExpr( ExprLhs const& expr ) { diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp index e96c3be2..c271146d 100644 --- a/include/internal/catch_common.cpp +++ b/include/internal/catch_common.cpp @@ -15,10 +15,6 @@ namespace Catch { - SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} bool SourceLineInfo::empty() const noexcept { return file[0] == '\0'; } diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index c1a771c1..3bdde156 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -43,7 +43,10 @@ namespace Catch { struct SourceLineInfo { SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept; + SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} SourceLineInfo( SourceLineInfo const& other ) = default; SourceLineInfo( SourceLineInfo && ) = default; diff --git a/include/internal/catch_context.cpp b/include/internal/catch_context.cpp index 0341a6f1..e116f28f 100644 --- a/include/internal/catch_context.cpp +++ b/include/internal/catch_context.cpp @@ -20,7 +20,7 @@ namespace Catch { return m_runner; } - virtual IConfigPtr getConfig() const override { + virtual IConfigPtr const& getConfig() const override { return m_config; } diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h index eb8611cc..3d3c6bad 100644 --- a/include/internal/catch_context.h +++ b/include/internal/catch_context.h @@ -25,7 +25,7 @@ namespace Catch { virtual IResultCapture* getResultCapture() = 0; virtual IRunner* getRunner() = 0; - virtual IConfigPtr getConfig() const = 0; + virtual IConfigPtr const& getConfig() const = 0; }; struct IMutableContext : IContext diff --git a/include/internal/catch_result_type.cpp b/include/internal/catch_result_type.cpp index 6e048865..0f62f1b8 100644 --- a/include/internal/catch_result_type.cpp +++ b/include/internal/catch_result_type.cpp @@ -22,7 +22,6 @@ namespace Catch { } bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } - bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } } // end namespace Catch diff --git a/include/internal/catch_result_type.h b/include/internal/catch_result_type.h index 6934fc11..000b4f3d 100644 --- a/include/internal/catch_result_type.h +++ b/include/internal/catch_result_type.h @@ -47,7 +47,7 @@ namespace Catch { ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); bool shouldContinueOnFailure( int flags ); - bool isFalseTest( int flags ); + inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } bool shouldSuppressFailure( int flags ); } // end namespace Catch