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

stdout retained for all sections

Fixed issue where stdout was dropped between sections
Commit
b13ad46532c644dc2578b9be544eaa141403aecc
Author
Phil Nash ·
Parents
458e5eec1649

Files · Download .tar.gz

Changes

 include/internal/catch_runner_impl.hpp             |  4 ++--
 include/internal/catch_test_case_registry_impl.hpp |  1 -
 projects/SelfTest/MessageTests.cpp                 | 26 ++++++++++++++++++++++
 projects/SelfTest/TestMain.cpp                     |  2 +-
 .../xcdebugger/Breakpoints.xcbkptlist              |  5 +++++
 .../xcschemes/CatchSelfTest.xcscheme               |  6 +++++
 6 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp
index c7b100e0..f93f2c45 100644
--- a/include/internal/catch_runner_impl.hpp
+++ b/include/internal/catch_runner_impl.hpp
@@ -1,4 +1,4 @@
-/*
+ /*
  *  catch_runner.hpp
  *  Catch
  *
@@ -45,7 +45,7 @@ namespace Catch
         ~StreamRedirect
         ()
         {
-            m_targetString = m_oss.str();
+            m_targetString += m_oss.str();
             m_stream.rdbuf( m_prevBuf );
         }
         
diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp
index 2c368e47..ea30f234 100644
--- a/include/internal/catch_test_case_registry_impl.hpp
+++ b/include/internal/catch_test_case_registry_impl.hpp
@@ -74,7 +74,6 @@ namespace Catch
                 if( testSpec.matches( it->getName() ) )
                 {
                     testList.push_back( *it );
-                    std::cout << it->getName() << std::endl;
                 }
             }
             return testList;
diff --git a/projects/SelfTest/MessageTests.cpp b/projects/SelfTest/MessageTests.cpp
index 9ebfdf88..a6324a34 100644
--- a/projects/SelfTest/MessageTests.cpp
+++ b/projects/SelfTest/MessageTests.cpp
@@ -49,3 +49,29 @@ TEST_CASE( "./failing/message/fail", "FAIL aborts the test" )
 {
     FAIL( "This is a " << "failure" );    // This should output the message and abort
 }
+
+TEST_CASE( "./failing/message/sections", "Output from all sections is reported" )
+{
+    SECTION( "one", "" )
+    {
+        FAIL( "Message from section one" );
+    }
+
+    SECTION( "two", "" )
+    {
+        FAIL( "Message from section two" );
+    }
+}
+
+TEST_CASE( "./succeeding/message/sections/stdout", "Output from all sections is reported" )
+{
+    SECTION( "one", "" )
+    {
+        std::cout << "Message from section one" << std::endl;
+    }
+    
+    SECTION( "two", "" )
+    {
+        std::cout << "Message from section two" << std::endl;
+    }
+}
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index a039bc2e..0ca760e5 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -56,7 +56,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
         {
             runner.runMatching( "./failing/*" );        
             CHECK( runner.getSuccessCount() == 0 );
-            CHECK( runner.getFailureCount() == 62 );
+            CHECK( runner.getFailureCount() == 64 );
         }
     }
 }
diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
new file mode 100644
index 00000000..05301bc2
--- /dev/null
+++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+   type = "1"
+   version = "1.0">
+</Bucket>
diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcschemes/CatchSelfTest.xcscheme b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcschemes/CatchSelfTest.xcscheme
index 070775e4..e18856f0 100644
--- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcschemes/CatchSelfTest.xcscheme
+++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/xcuserdata/Phil.xcuserdatad/xcschemes/CatchSelfTest.xcscheme
@@ -55,6 +55,12 @@
             ReferencedContainer = "container:CatchSelfTest.xcodeproj">
          </BuildableReference>
       </BuildableProductRunnable>
+      <CommandLineArguments>
+         <CommandLineArgument
+            argument = "-t ./succeeding/message/sections/stdout"
+            isEnabled = "NO">
+         </CommandLineArgument>
+      </CommandLineArguments>
       <AdditionalOptions>
       </AdditionalOptions>
    </LaunchAction>