From 3d0fed768a7201668b92219df6db54fa6e324c00 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 10 Nov 2010 19:18:46 +0000 Subject: [PATCH] Fixed a == 1 || b == 2 case --- Test/TrickyTests.cpp | 11 ++++++++++- internal/catch_capture.hpp | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Test/TrickyTests.cpp b/Test/TrickyTests.cpp index 51ee8898..e2fbb6be 100644 --- a/Test/TrickyTests.cpp +++ b/Test/TrickyTests.cpp @@ -24,11 +24,20 @@ namespace Catch } } -TEST_CASE( "succeeding/Tricky", "Some tricky to parse tests" ) +TEST_CASE( "succeeding/Tricky/std::pair", "Parsing a std::pair" ) { std::pair aNicePair( 1, 2 ); // !TBD: would be nice if this could compile without the extra parentheses EXPECT( (std::pair( 1, 2 )) == aNicePair ); +} + +TEST_CASE( "succeeding/Tricky/complex lhs", "Where the LHS is not a simple value" ) +{ + int a = 1; + int b = 2; + + // !TBD: This only captures part of the expression + EXPECT( a == 2 || b == 2 ); } \ No newline at end of file diff --git a/internal/catch_capture.hpp b/internal/catch_capture.hpp index 9333fa4a..4392c415 100644 --- a/internal/catch_capture.hpp +++ b/internal/catch_capture.hpp @@ -59,6 +59,14 @@ public: { m_message = message; } + + template + MutableResultInfo& operator ||( const RhsT& rhs ) + { + // !TBD: set message to say we haven't captured all parts + return *this; + } + private: friend class ResultBuilder; @@ -118,6 +126,7 @@ public: { return m_result.setRhs( ">=", toString( rhs ) ); } + operator MutableResultInfo&() { return m_result;