diff options
author | 2017-02-05 15:45:26 +0100 | |
---|---|---|
committer | 2017-02-05 15:46:07 +0100 | |
commit | 02c97cd0f7c4d630f1a90f9f2626746e47a28c09 (patch) | |
tree | 2b48d051a55f2b65525824546cd9fcf9e05907cf /3rdparty/catch/include/internal/catch_result_builder.h | |
parent | d20b4ba6864b45d0c068d98d43e63c8bc5014a3b (diff) |
Updated Catch to latest (nw)
Diffstat (limited to '3rdparty/catch/include/internal/catch_result_builder.h')
-rw-r--r-- | 3rdparty/catch/include/internal/catch_result_builder.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/3rdparty/catch/include/internal/catch_result_builder.h b/3rdparty/catch/include/internal/catch_result_builder.h index 89002660d96..dfdffd5f51f 100644 --- a/3rdparty/catch/include/internal/catch_result_builder.h +++ b/3rdparty/catch/include/internal/catch_result_builder.h @@ -19,22 +19,20 @@ namespace Catch { template<typename T> class ExpressionLhs; - struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; - struct CopyableStream { CopyableStream() {} CopyableStream( CopyableStream const& other ) { oss << other.oss.str(); } CopyableStream& operator=( CopyableStream const& other ) { - oss.str(""); + oss.str(std::string()); oss << other.oss.str(); return *this; } std::ostringstream oss; }; - class ResultBuilder { + class ResultBuilder : public DecomposedExpression { public: ResultBuilder( char const* macroName, SourceLineInfo const& lineInfo, @@ -52,19 +50,15 @@ namespace Catch { return *this; } - template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( RhsT const& ); - template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( RhsT const& ); - ResultBuilder& setResultType( ResultWas::OfType result ); ResultBuilder& setResultType( bool result ); - ResultBuilder& setLhs( std::string const& lhs ); - ResultBuilder& setRhs( std::string const& rhs ); - ResultBuilder& setOp( std::string const& op ); - void endExpression(); + void endExpression( DecomposedExpression const& expr ); + + virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE; - std::string reconstructExpression() const; AssertionResult build() const; + AssertionResult build( DecomposedExpression const& expr ) const; void useActiveException( ResultDisposition::Flags resultDisposition = ResultDisposition::Normal ); void captureResult( ResultWas::OfType resultType ); @@ -76,14 +70,12 @@ namespace Catch { bool shouldDebugBreak() const; bool allowThrows() const; + template<typename ArgT, typename MatcherT> + void captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString ); + private: AssertionInfo m_assertionInfo; AssertionResultData m_data; - struct ExprComponents { - ExprComponents() : testFalse( false ) {} - bool testFalse; - std::string lhs, rhs, op; - } m_exprComponents; CopyableStream m_stream; bool m_shouldDebugBreak; @@ -106,6 +98,14 @@ namespace Catch { return ExpressionLhs<bool>( *this, value ); } + template<typename ArgT, typename MatcherT> + inline void ResultBuilder::captureMatch( ArgT const& arg, MatcherT const& matcher, + char const* matcherString ) { + MatchExpression<ArgT const&, MatcherT const&> expr( arg, matcher, matcherString ); + setResultType( matcher.match( arg ) ); + endExpression( expr ); + } + } // namespace Catch #endif // TWOBLUECUBES_CATCH_RESULT_BUILDER_H_INCLUDED |