Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fixed a == 1 || b == 2 case

Commit
3d0fed768a7201668b92219df6db54fa6e324c00
Author
Phil Nash ·
Parents
e3bcf68f7ae3

Files · Download .tar.gz

Changes

 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<int, int> aNicePair( 1, 2 );
 
     // !TBD: would be nice if this could compile without the extra parentheses
     EXPECT( (std::pair<int, int>( 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<typename RhsT>
+    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;