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 writeToDebugConsole out of main path

Commit
5932576f534ef08a3d13b0cd99464999dbe7b50b
Author
Martin Hořeňovský ·
Parents
faead531518a

Files · Download .tar.gz

Changes

 CMakeLists.txt                           |  2 ++
 include/internal/catch_debug_console.cpp | 29 +++++++++++++++++++++++++++++
 include/internal/catch_debug_console.h   | 17 +++++++++++++++++
 include/internal/catch_debugger.cpp      | 18 ------------------
 include/internal/catch_debugger.h        |  6 +-----
 include/internal/catch_stream.cpp        |  2 +-
 6 files changed, 50 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b538f5d7..8248ed99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,6 +132,7 @@ set(INTERNAL_HEADERS
         ${HEADER_DIR}/internal/catch_config.hpp
         ${HEADER_DIR}/internal/catch_console_colour.hpp
         ${HEADER_DIR}/internal/catch_context.h
+        ${HEADER_DIR}/internal/catch_debug_console.h
         ${HEADER_DIR}/internal/catch_debugger.h
         ${HEADER_DIR}/internal/catch_decomposer.h
         ${HEADER_DIR}/internal/catch_default_main.hpp
@@ -203,6 +204,7 @@ set(IMPL_SOURCES
         ${HEADER_DIR}/internal/catch_config.cpp
         ${HEADER_DIR}/internal/catch_console_colour.cpp
         ${HEADER_DIR}/internal/catch_context.cpp
+        ${HEADER_DIR}/internal/catch_debug_console.cpp
         ${HEADER_DIR}/internal/catch_debugger.cpp
         ${HEADER_DIR}/internal/catch_decomposer.cpp
         ${HEADER_DIR}/internal/catch_errno_guard.cpp
diff --git a/include/internal/catch_debug_console.cpp b/include/internal/catch_debug_console.cpp
new file mode 100644
index 00000000..d817c561
--- /dev/null
+++ b/include/internal/catch_debug_console.cpp
@@ -0,0 +1,29 @@
+/*
+ *  Created by Martin on 29/08/2017.
+ *
+ *  Distributed under the Boost Software License, Version 1.0. (See accompanying
+ *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+#include "catch_debug_console.h"
+#include "catch_stream.h"
+#include "catch_platform.h"
+
+#ifdef CATCH_PLATFORM_WINDOWS
+
+#include "catch_windows_h_proxy.h"
+
+    namespace Catch {
+        void writeToDebugConsole( std::string const& text ) {
+            ::OutputDebugStringA( text.c_str() );
+        }
+    }
+#else
+    namespace Catch {
+        void writeToDebugConsole( std::string const& text ) {
+            // !TBD: Need a version for Mac/ XCode and other IDEs
+            Catch::cout() << text;
+        }
+    }
+#endif // Platform
diff --git a/include/internal/catch_debug_console.h b/include/internal/catch_debug_console.h
new file mode 100644
index 00000000..2c229a83
--- /dev/null
+++ b/include/internal/catch_debug_console.h
@@ -0,0 +1,17 @@
+/*
+ *  Created by Martin on 29/08/2017.
+ *
+ *  Distributed under the Boost Software License, Version 1.0. (See accompanying
+ *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
+
+#include <string>
+
+namespace Catch {
+    void writeToDebugConsole( std::string const& text );
+}
+
+#endif // TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
diff --git a/include/internal/catch_debugger.cpp b/include/internal/catch_debugger.cpp
index 4d05c85a..a467e9fd 100644
--- a/include/internal/catch_debugger.cpp
+++ b/include/internal/catch_debugger.cpp
@@ -109,21 +109,3 @@
        bool isDebuggerActive() { return false; }
     }
 #endif // Platform
-
-#ifdef CATCH_PLATFORM_WINDOWS
-
-#include "catch_windows_h_proxy.h"
-
-    namespace Catch {
-        void writeToDebugConsole( std::string const& text ) {
-            ::OutputDebugStringA( text.c_str() );
-        }
-    }
-#else
-    namespace Catch {
-        void writeToDebugConsole( std::string const& text ) {
-            // !TBD: Need a version for Mac/ XCode and other IDEs
-            Catch::cout() << text;
-        }
-    }
-#endif // Platform
diff --git a/include/internal/catch_debugger.h b/include/internal/catch_debugger.h
index 279bec06..f842ff5b 100644
--- a/include/internal/catch_debugger.h
+++ b/include/internal/catch_debugger.h
@@ -11,12 +11,8 @@
 
 #include "catch_platform.h"
 
-#include <string>
-
-namespace Catch{
-
+namespace Catch {
     bool isDebuggerActive();
-    void writeToDebugConsole( std::string const& text );
 }
 
 #ifdef CATCH_PLATFORM_MAC
diff --git a/include/internal/catch_stream.cpp b/include/internal/catch_stream.cpp
index 81dbdd47..4278317d 100644
--- a/include/internal/catch_stream.cpp
+++ b/include/internal/catch_stream.cpp
@@ -10,7 +10,7 @@
 #include "catch_common.h"
 #include "catch_enforce.h"
 #include "catch_stream.h"
-#include "catch_debugger.h"
+#include "catch_debug_console.h"
 
 #include <stdexcept>
 #include <cstdio>