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

Split out the StreamEndStop helper into its own header

Commit
1982c0d5eef1c68a4c5b652fda8575ab3db7a839
Author
Martin Hořeňovský ·
Parents
0442229dc93f

Files · Download .tar.gz

Changes

 src/CMakeLists.txt                            |  1 +
 src/catch2/catch_all.hpp                      |  1 +
 src/catch2/catch_message.hpp                  |  4 +++-
 src/catch2/internal/catch_common.hpp          | 16 --------------
 src/catch2/internal/catch_stream_end_stop.hpp | 30 +++++++++++++++++++++++++++
 5 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2c6aaba3..4aaea817 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -109,6 +109,7 @@ set(INTERNAL_HEADERS
     ${SOURCES_DIR}/internal/catch_singletons.hpp
     ${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp
     ${SOURCES_DIR}/internal/catch_stream.hpp
+    ${SOURCES_DIR}/internal/catch_stream_end_stop.hpp
     ${SOURCES_DIR}/internal/catch_string_manip.hpp
     ${SOURCES_DIR}/internal/catch_stringref.hpp
     ${SOURCES_DIR}/catch_tag_alias.hpp
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp
index 6e93d54c..ed035223 100644
--- a/src/catch2/catch_all.hpp
+++ b/src/catch2/catch_all.hpp
@@ -83,6 +83,7 @@
 #include <catch2/internal/catch_singletons.hpp>
 #include <catch2/internal/catch_startup_exception_registry.hpp>
 #include <catch2/internal/catch_stream.hpp>
+#include <catch2/internal/catch_stream_end_stop.hpp>
 #include <catch2/internal/catch_string_manip.hpp>
 #include <catch2/internal/catch_stringref.hpp>
 #include <catch2/internal/catch_tag_alias_registry.hpp>
diff --git a/src/catch2/catch_message.hpp b/src/catch2/catch_message.hpp
index 21e666bc..db60b6bf 100644
--- a/src/catch2/catch_message.hpp
+++ b/src/catch2/catch_message.hpp
@@ -9,8 +9,8 @@
 #define CATCH_MESSAGE_HPP_INCLUDED
 
 #include <catch2/internal/catch_result_type.hpp>
-#include <catch2/internal/catch_common.hpp>
 #include <catch2/internal/catch_stream.hpp>
+#include <catch2/internal/catch_stream_end_stop.hpp>
 #include <catch2/internal/catch_message_info.hpp>
 #include <catch2/interfaces/catch_interfaces_capture.hpp>
 #include <catch2/catch_tostring.hpp>
@@ -20,6 +20,8 @@
 
 namespace Catch {
 
+    struct SourceLineInfo;
+
     struct MessageStream {
 
         template<typename T>
diff --git a/src/catch2/internal/catch_common.hpp b/src/catch2/internal/catch_common.hpp
index 8e13a90e..82360594 100644
--- a/src/catch2/internal/catch_common.hpp
+++ b/src/catch2/internal/catch_common.hpp
@@ -9,7 +9,6 @@
 #define CATCH_COMMON_HPP_INCLUDED
 
 #include <catch2/internal/catch_compiler_capabilities.hpp>
-#include <catch2/internal/catch_stringref.hpp>
 
 #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
 #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
@@ -49,21 +48,6 @@ namespace Catch {
     // This is necessary because the overload of operator<< above makes
     // lookup stop at namespace Catch
     using ::operator<<;
-
-    // Use this in variadic streaming macros to allow
-    //    >> +StreamEndStop
-    // as well as
-    //    >> stuff +StreamEndStop
-    struct StreamEndStop {
-        StringRef operator+() const {
-            return StringRef();
-        }
-
-        template<typename T>
-        friend T const& operator + ( T const& value, StreamEndStop ) {
-            return value;
-        }
-    };
 }
 
 #define CATCH_INTERNAL_LINEINFO \
diff --git a/src/catch2/internal/catch_stream_end_stop.hpp b/src/catch2/internal/catch_stream_end_stop.hpp
new file mode 100644
index 00000000..452ca1e9
--- /dev/null
+++ b/src/catch2/internal/catch_stream_end_stop.hpp
@@ -0,0 +1,30 @@
+
+//              Copyright Catch2 Authors
+// Distributed under the Boost Software License, Version 1.0.
+//   (See accompanying file LICENSE_1_0.txt or copy at
+//        https://www.boost.org/LICENSE_1_0.txt)
+
+// SPDX-License-Identifier: BSL-1.0
+#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED
+#define CATCH_STREAM_END_STOP_HPP_INCLUDED
+
+#include <catch2/internal/catch_stringref.hpp>
+
+namespace Catch {
+
+    // Use this in variadic streaming macros to allow
+    //    << +StreamEndStop
+    // as well as
+    //    << stuff +StreamEndStop
+    struct StreamEndStop {
+        StringRef operator+() const { return StringRef(); }
+
+        template <typename T>
+        friend T const& operator+( T const& value, StreamEndStop ) {
+            return value;
+        }
+    };
+
+} // namespace Catch
+
+#endif // CATCH_STREAM_END_STOP_HPP_INCLUDED