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

v1.7.1 build

Commit
7b8a27eadb70bc92c0027e5028b47526095a719d
Author
Martin Hořeňovský ·
Parents
2b74613c5452

Files · Download .tar.gz

Changes

 README.md                          |   4 +-
 docs/release-notes.md              |  23 ++++--
 include/internal/catch_version.hpp |   2 +-
 single_include/catch.hpp           | 140 ++++++++++++++++++++++---------------
 4 files changed, 102 insertions(+), 67 deletions(-)

diff --git a/README.md b/README.md
index 06edcc26..7c3f4527 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
 ![catch logo](catch-logo-small.png)
 
-*v1.7.0*
+*v1.7.1*
 
 Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch)
 
-<a href="https://github.com/philsquared/Catch/releases/download/v1.7.0/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
+<a href="https://github.com/philsquared/Catch/releases/download/v1.7.1/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
 
 ## What's the Catch?
 
diff --git a/docs/release-notes.md b/docs/release-notes.md
index bec9910e..0fbf9eef 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -1,4 +1,19 @@
-# 1.7.0
+# 1.7.1
+
+### Fixes:
+* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
+* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
+  * For specifics, look into the [documentation](docs/configuration.md).
+* Fixed compilation error under MinGW caused by improper compiler detection.
+* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
+* Fixed XML reporter not reporting captured stdout/stderr.
+* Fixed possible infinite recursion in Windows SEH.
+* Fixed possible compilation error caused by Catch's operator overloads being ambiguous in regards to user-defined templated operators.
+
+# Older versions
+Release notes were not maintained prior to v1.6.0, but you should be able to work them out from the Git history
+
+## 1.7.0
 
 ### Features/ Changes:
 * Catch now runs significantly faster for passing tests
@@ -25,12 +40,6 @@
 * Catch's CMakeLists now generates projects with warnings enabled.
 
 
-
-
-
-# Older versions
-Release notes were not maintained prior to v1.6.0, but you should be able to work them out from the Git history
-
 ## 1.6.1
 
 ### Features/ Changes:
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index 279facf5..1348989c 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -37,7 +37,7 @@ namespace Catch {
         return os;
     }
 
-    Version libraryVersion( 1, 7, 0, "", 0 );
+    Version libraryVersion( 1, 7, 1, "", 0 );
 
 }
 
diff --git a/single_include/catch.hpp b/single_include/catch.hpp
index 99c93f17..6a0a58ed 100644
--- a/single_include/catch.hpp
+++ b/single_include/catch.hpp
@@ -1,6 +1,6 @@
 /*
- *  Catch v1.7.0
- *  Generated: 2017-02-01 21:32:13.239291
+ *  Catch v1.7.1
+ *  Generated: 2017-02-07 09:44:56.263047
  *  ----------------------------------------------------------
  *  This file has been merged from multiple headers. Please don't edit it directly
  *  Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -81,6 +81,7 @@
 
 // CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
 // CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
+// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
 // ****************
 // Note to maintainers: if new toggles are added please document them
 // in configuration.md, too
@@ -160,6 +161,8 @@
 // Visual C++
 #ifdef _MSC_VER
 
+#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
+
 #if (_MSC_VER >= 1600)
 #   define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
 #   define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
@@ -284,6 +287,9 @@
 # if defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_NO_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_NO_CPP11)
 #  define CATCH_CONFIG_CPP11_TYPE_TRAITS
 # endif
+#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
+#   define CATCH_CONFIG_WINDOWS_SEH
+#endif
 
 #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
 #   define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
@@ -1878,45 +1884,45 @@ public:
 
     template<typename RhsT>
     BinaryExpression<T, Internal::IsEqualTo, RhsT const&>
-    operator == ( RhsT const& rhs ) const {
+    operator == ( RhsT const& rhs ) {
         return captureExpression<Internal::IsEqualTo>( rhs );
     }
 
     template<typename RhsT>
     BinaryExpression<T, Internal::IsNotEqualTo, RhsT const&>
-    operator != ( RhsT const& rhs ) const {
+    operator != ( RhsT const& rhs ) {
         return captureExpression<Internal::IsNotEqualTo>( rhs );
     }
 
     template<typename RhsT>
     BinaryExpression<T, Internal::IsLessThan, RhsT const&>
-    operator < ( RhsT const& rhs ) const {
+    operator < ( RhsT const& rhs ) {
         return captureExpression<Internal::IsLessThan>( rhs );
     }
 
     template<typename RhsT>
     BinaryExpression<T, Internal::IsGreaterThan, RhsT const&>
-    operator > ( RhsT const& rhs ) const {
+    operator > ( RhsT const& rhs ) {
         return captureExpression<Internal::IsGreaterThan>( rhs );
     }
 
     template<typename RhsT>
     BinaryExpression<T, Internal::IsLessThanOrEqualTo, RhsT const&>
-    operator <= ( RhsT const& rhs ) const {
+    operator <= ( RhsT const& rhs ) {
         return captureExpression<Internal::IsLessThanOrEqualTo>( rhs );
     }
 
     template<typename RhsT>
     BinaryExpression<T, Internal::IsGreaterThanOrEqualTo, RhsT const&>
-    operator >= ( RhsT const& rhs ) const {
+    operator >= ( RhsT const& rhs ) {
         return captureExpression<Internal::IsGreaterThanOrEqualTo>( rhs );
     }
 
-    BinaryExpression<T, Internal::IsEqualTo, bool> operator == ( bool rhs ) const {
+    BinaryExpression<T, Internal::IsEqualTo, bool> operator == ( bool rhs ) {
         return captureExpression<Internal::IsEqualTo>( rhs );
     }
 
-    BinaryExpression<T, Internal::IsNotEqualTo, bool> operator != ( bool rhs ) const {
+    BinaryExpression<T, Internal::IsNotEqualTo, bool> operator != ( bool rhs ) {
         return captureExpression<Internal::IsNotEqualTo>( rhs );
     }
 
@@ -6117,12 +6123,40 @@ namespace Catch {
 } // namespace Catch
 
 #if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
+// #included from: catch_windows_h_proxy.h
+
+#define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
+
+#ifdef CATCH_DEFINES_NOMINMAX
+#  define NOMINMAX
+#endif
+#ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
 
-#define NOMINMAX
-#define WIN32_LEAN_AND_MEAN
+#ifdef __AFXDLL
+#include <AfxWin.h>
+#else
 #include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#undef NOMINMAX
+#endif
+
+#ifdef CATCH_DEFINES_NOMINMAX
+#  undef NOMINMAX
+#endif
+#ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
+#  undef WIN32_LEAN_AND_MEAN
+#endif
+
+
+#  if !defined ( CATCH_CONFIG_WINDOWS_SEH )
+
+namespace Catch {
+    struct FatalConditionHandler {
+        void reset() {}
+    };
+}
+
+#  else // CATCH_CONFIG_WINDOWS_SEH is defined
 
 namespace Catch {
 
@@ -6143,6 +6177,7 @@ namespace Catch {
         static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
             for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
                 if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
+                    reset();
                     reportFatal(signalDefs[i].name);
                 }
             }
@@ -6151,22 +6186,25 @@ namespace Catch {
             return EXCEPTION_CONTINUE_SEARCH;
         }
 
-        // 32k seems enough for Catch to handle stack overflow,
-        // but the value was found experimentally, so there is no strong guarantee
-        FatalConditionHandler():m_isSet(true), m_guaranteeSize(32 * 1024), m_exceptionHandlerHandle(CATCH_NULL) {
+        FatalConditionHandler() {
+            isSet = true;
+            // 32k seems enough for Catch to handle stack overflow,
+            // but the value was found experimentally, so there is no strong guarantee
+            guaranteeSize = 32 * 1024;
+            exceptionHandlerHandle = CATCH_NULL;
             // Register as first handler in current chain
-            m_exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
+            exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
             // Pass in guarantee size to be filled
-            SetThreadStackGuarantee(&m_guaranteeSize);
+            SetThreadStackGuarantee(&guaranteeSize);
         }
 
-        void reset() {
-            if (m_isSet) {
+        static void reset() {
+            if (isSet) {
                 // Unregister handler and restore the old guarantee
-                RemoveVectoredExceptionHandler(m_exceptionHandlerHandle);
-                SetThreadStackGuarantee(&m_guaranteeSize);
-                m_exceptionHandlerHandle = CATCH_NULL;
-                m_isSet = false;
+                RemoveVectoredExceptionHandler(exceptionHandlerHandle);
+                SetThreadStackGuarantee(&guaranteeSize);
+                exceptionHandlerHandle = CATCH_NULL;
+                isSet = false;
             }
         }
 
@@ -6174,13 +6212,19 @@ namespace Catch {
             reset();
         }
     private:
-        bool m_isSet;
-        ULONG m_guaranteeSize;
-        PVOID m_exceptionHandlerHandle;
+        static bool isSet;
+        static ULONG guaranteeSize;
+        static PVOID exceptionHandlerHandle;
     };
 
+    bool FatalConditionHandler::isSet = false;
+    ULONG FatalConditionHandler::guaranteeSize = 0;
+    PVOID FatalConditionHandler::exceptionHandlerHandle = CATCH_NULL;
+
 } // namespace Catch
 
+#  endif // CATCH_CONFIG_WINDOWS_SEH
+
 #else // Not Windows - assumed to be POSIX compatible //////////////////////////
 
 #include <signal.h>
@@ -7440,30 +7484,6 @@ namespace Catch {
 
 #if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
 
-// #included from: catch_windows_h_proxy.h
-
-#define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
-
-#ifdef CATCH_DEFINES_NOMINMAX
-#  define NOMINMAX
-#endif
-#ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
-#  define WIN32_LEAN_AND_MEAN
-#endif
-
-#ifdef __AFXDLL
-#include <AfxWin.h>
-#else
-#include <windows.h>
-#endif
-
-#ifdef CATCH_DEFINES_NOMINMAX
-#  undef NOMINMAX
-#endif
-#ifdef CATCH_DEFINES_WIN32_LEAN_AND_MEAN
-#  undef WIN32_LEAN_AND_MEAN
-#endif
-
 namespace Catch {
 namespace {
 
@@ -7989,7 +8009,7 @@ namespace Catch {
         return os;
     }
 
-    Version libraryVersion( 1, 7, 0, "", 0 );
+    Version libraryVersion( 1, 7, 1, "", 0 );
 
 }
 
@@ -9506,12 +9526,13 @@ namespace Catch {
             newlineIfNecessary();
             m_indent = m_indent.substr( 0, m_indent.size()-2 );
             if( m_tagIsOpen ) {
-                stream() << "/>\n";
+                stream() << "/>";
                 m_tagIsOpen = false;
             }
             else {
-                stream() << m_indent << "</" << m_tags.back() << ">\n";
+                stream() << m_indent << "</" << m_tags.back() << ">";
             }
+            stream() << std::endl;
             m_tags.pop_back();
             return *this;
         }
@@ -9757,6 +9778,11 @@ namespace Catch {
             if ( m_config->showDurations() == ShowDurations::Always )
                 e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
 
+            if( !testCaseStats.stdOut.empty() )
+                m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false );
+            if( !testCaseStats.stdErr.empty() )
+                m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false );
+
             m_xml.endElement();
         }
 
@@ -9804,7 +9830,7 @@ namespace Catch {
             std::time(&rawtime);
             const size_t timeStampSize = sizeof("2017-01-16T17:06:45Z");
 
-#ifdef CATCH_PLATFORM_WINDOWS
+#ifdef _MSC_VER
             std::tm timeInfo = {};
             gmtime_s(&timeInfo, &rawtime);
 #else
@@ -9815,7 +9841,7 @@ namespace Catch {
             char timeStamp[timeStampSize];
             const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
 
-#ifdef CATCH_PLATFORM_WINDOWS
+#ifdef _MSC_VER
             std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
 #else
             std::strftime(timeStamp, timeStampSize, fmt, timeInfo);