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 iOS test runner after reporter changes

Commit
e1f1c6ca7e0e79b19a2800ba25f4a426d89880d2
Author
Phil Nash ·
Parents
20df8c5da186

Files · Download .tar.gz

Changes

 include/internal/catch_console_colour_impl.hpp     |  2 +-
 .../iTchRunner/internal/iTchRunnerMainView.h       |  8 ++---
 .../iTchRunner/internal/iTchRunnerReporter.h       | 34 ++++++++++++----------
 3 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp
index e5c9d680..d1d49f34 100644
--- a/include/internal/catch_console_colour_impl.hpp
+++ b/include/internal/catch_console_colour_impl.hpp
@@ -49,7 +49,7 @@ namespace Catch
     {
         ConsoleColourImpl()
         :   hStdout( GetStdHandle(STD_OUTPUT_HANDLE) ),
-        wOldColorAttrs( 0 )
+            wOldColorAttrs( 0 )
         {
             GetConsoleScreenBufferInfo( hStdout, &csbiInfo );
             wOldColorAttrs = csbiInfo.wAttributes;
diff --git a/projects/runners/iTchRunner/internal/iTchRunnerMainView.h b/projects/runners/iTchRunner/internal/iTchRunnerMainView.h
index eee89352..721c4918 100644
--- a/projects/runners/iTchRunner/internal/iTchRunnerMainView.h
+++ b/projects/runners/iTchRunner/internal/iTchRunnerMainView.h
@@ -80,17 +80,17 @@
     
     config.getReporter()->StartGroup( "" );
     runner.runAll( true );
-    config.getReporter()->EndGroup( "", runner.getSuccessCount(), runner.getFailureCount() );
+    config.getReporter()->EndGroup( "", runner.getTotals() );
 
-    if( runner.getFailureCount() == 0 )
+    if( runner.getTotals().assertions.failed == 0 )
     {
         NSLog( @"no failures" );
-        if( runner.getSuccessCount() > 0 )
+        if( runner.getTotals().assertions.passed > 0 )
             appName.textColor = [[UIColor alloc] initWithRed:0.35 green:1 blue:0.35 alpha:1];
     }
     else
     {
-        NSLog( @"%lu failures", runner.getFailureCount() );
+        NSLog( @"%lu failures", runner.getTotals().assertions.failed );
         appName.textColor = [[UIColor alloc] initWithRed:1 green:0.35 blue:0.35 alpha:1];
     }
 }
diff --git a/projects/runners/iTchRunner/internal/iTchRunnerReporter.h b/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
index 35c1f0a1..4d3bd566 100644
--- a/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
+++ b/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
@@ -24,11 +24,17 @@ namespace Catch
         (
             id<iTchRunnerDelegate> delegate
         )
-        :   m_succeeded( 0 ),
-            m_failed( 0 ),
-            m_delegate( delegate )
+        :   m_delegate( delegate )
         {
         }
+
+        ///////////////////////////////////////////////////////////////////////////
+        virtual bool shouldRedirectStdout
+        ()
+        const
+        {
+            return true;
+        }
         
         ///////////////////////////////////////////////////////////////////////////
         static std::string getDescription
@@ -42,7 +48,7 @@ namespace Catch
         ()
         const
         {
-            return m_succeeded;
+            return m_totals.assertions.passed;
         }
         
         ///////////////////////////////////////////////////////////////////////////
@@ -50,14 +56,13 @@ namespace Catch
         ()
         const
         {
-            return m_failed;
+            return m_totals.assertions.failed;
         }
         
         ///////////////////////////////////////////////////////////////////////////
         void reset()
         {
-            m_succeeded = 0;
-            m_failed = 0;
+            m_totals = Totals();
         }
         
     private: // IReporter
@@ -70,12 +75,10 @@ namespace Catch
         ///////////////////////////////////////////////////////////////////////////
         virtual void EndTesting
         (
-            std::size_t succeeded, 
-            std::size_t failed
+            const Totals& totals
         )
         {
-            m_succeeded = succeeded;
-            m_failed = failed;
+            m_totals = totals;
         }
         
         ///////////////////////////////////////////////////////////////////////////
@@ -90,15 +93,14 @@ namespace Catch
         ///////////////////////////////////////////////////////////////////////////
         // Deliberately unimplemented:
         virtual void StartGroup( const std::string& ){}
-        virtual void EndGroup( const std::string&, std::size_t, std::size_t ){}
+        virtual void EndGroup( const std::string&, const Totals& ){}
         virtual void StartTestCase( const TestCaseInfo& ){}
         virtual void StartSection( const std::string&, const std::string ){}
-        virtual void EndSection( const std::string&, std::size_t, std::size_t ){}
-        virtual void EndTestCase( const TestCaseInfo&, std::size_t, std::size_t, const std::string&, const std::string& ){}
+        virtual void EndSection( const std::string&, const Counts& ){}
+        virtual void EndTestCase( const TestCaseInfo&, const Totals&, const std::string&, const std::string& ){}
         
     private:
-        size_t m_succeeded;
-        size_t m_failed;
+        Totals m_totals;
         
         id<iTchRunnerDelegate> m_delegate;
     };