Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-04-16 14:12:56 +0200
committerMartin Hořeňovský2022-04-16 16:33:50 +0200
commit05e85c5652480b584287f406b2170f61b02d560c (patch)
tree9ffc1e68450480f16dfc67e1a88a5890d7b56c9d /src
parentb5202576766c63a29275a8386a8e3c0439089382 (diff)
downloadcatch3-05e85c5652480b584287f406b2170f61b02d560c.tar.gz
Split out Catch::cout/cerr/clog into their own file
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/catch2/catch_all.hpp1
-rw-r--r--src/catch2/catch_session.cpp2
-rw-r--r--src/catch2/internal/catch_debug_console.cpp6
-rw-r--r--src/catch2/internal/catch_debugger.cpp1
-rw-r--r--src/catch2/internal/catch_enforce.cpp1
-rw-r--r--src/catch2/internal/catch_fatal_condition_handler.cpp1
-rw-r--r--src/catch2/internal/catch_output_redirect.cpp1
-rw-r--r--src/catch2/internal/catch_stdstreams.cpp24
-rw-r--r--src/catch2/internal/catch_stdstreams.hpp22
-rw-r--r--src/catch2/internal/catch_stream.cpp10
-rw-r--r--src/catch2/internal/catch_stream.hpp4
-rw-r--r--src/catch2/reporters/catch_reporter_multi.cpp4
13 files changed, 62 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5c724a46..fdf30a87 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,6 +125,7 @@ set(INTERNAL_HEADERS
${SOURCES_DIR}/internal/catch_result_type.hpp
${SOURCES_DIR}/internal/catch_run_context.hpp
${SOURCES_DIR}/internal/catch_section.hpp
+ ${SOURCES_DIR}/internal/catch_stdstreams.hpp
${SOURCES_DIR}/catch_section_info.hpp
${SOURCES_DIR}/catch_session.hpp
${SOURCES_DIR}/internal/catch_singletons.hpp
@@ -198,6 +199,7 @@ set(IMPL_SOURCES
${SOURCES_DIR}/internal/catch_result_type.cpp
${SOURCES_DIR}/internal/catch_run_context.cpp
${SOURCES_DIR}/internal/catch_section.cpp
+ ${SOURCES_DIR}/internal/catch_stdstreams.cpp
${SOURCES_DIR}/catch_session.cpp
${SOURCES_DIR}/internal/catch_singletons.cpp
${SOURCES_DIR}/internal/catch_stream.cpp
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp
index 5367ef3e..ce3f49d3 100644
--- a/src/catch2/catch_all.hpp
+++ b/src/catch2/catch_all.hpp
@@ -91,6 +91,7 @@
#include <catch2/internal/catch_singletons.hpp>
#include <catch2/internal/catch_source_line_info.hpp>
#include <catch2/internal/catch_startup_exception_registry.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#include <catch2/internal/catch_stream.hpp>
#include <catch2/internal/catch_stream_end_stop.hpp>
#include <catch2/internal/catch_string_manip.hpp>
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp
index e6ad93a1..c2047aa2 100644
--- a/src/catch2/catch_session.cpp
+++ b/src/catch2/catch_session.cpp
@@ -11,7 +11,6 @@
#include <catch2/internal/catch_list.hpp>
#include <catch2/internal/catch_context.hpp>
#include <catch2/internal/catch_run_context.hpp>
-#include <catch2/internal/catch_stream.hpp>
#include <catch2/catch_test_spec.hpp>
#include <catch2/catch_version.hpp>
#include <catch2/interfaces/catch_interfaces_reporter.hpp>
@@ -23,6 +22,7 @@
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#include <algorithm>
#include <cassert>
diff --git a/src/catch2/internal/catch_debug_console.cpp b/src/catch2/internal/catch_debug_console.cpp
index d13cc0bb..ce351de0 100644
--- a/src/catch2/internal/catch_debug_console.cpp
+++ b/src/catch2/internal/catch_debug_console.cpp
@@ -5,13 +5,15 @@
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
+
#include <catch2/internal/catch_debug_console.hpp>
+
#include <catch2/internal/catch_config_android_logwrite.hpp>
#include <catch2/internal/catch_stream.hpp>
#include <catch2/internal/catch_platform.hpp>
#include <catch2/internal/catch_windows_h_proxy.hpp>
-
-#include <iosfwd>
+#include <catch2/catch_user_config.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#if defined(CATCH_CONFIG_ANDROID_LOGWRITE)
#include <android/log.h>
diff --git a/src/catch2/internal/catch_debugger.cpp b/src/catch2/internal/catch_debugger.cpp
index 3c80173a..57ade819 100644
--- a/src/catch2/internal/catch_debugger.cpp
+++ b/src/catch2/internal/catch_debugger.cpp
@@ -9,6 +9,7 @@
#include <catch2/internal/catch_errno_guard.hpp>
#include <catch2/internal/catch_stream.hpp>
#include <catch2/internal/catch_platform.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
diff --git a/src/catch2/internal/catch_enforce.cpp b/src/catch2/internal/catch_enforce.cpp
index 3f4962cb..4bc47ce3 100644
--- a/src/catch2/internal/catch_enforce.cpp
+++ b/src/catch2/internal/catch_enforce.cpp
@@ -6,6 +6,7 @@
// SPDX-License-Identifier: BSL-1.0
#include <catch2/internal/catch_enforce.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#include <stdexcept>
diff --git a/src/catch2/internal/catch_fatal_condition_handler.cpp b/src/catch2/internal/catch_fatal_condition_handler.cpp
index 410b9b8f..3afd46f5 100644
--- a/src/catch2/internal/catch_fatal_condition_handler.cpp
+++ b/src/catch2/internal/catch_fatal_condition_handler.cpp
@@ -30,6 +30,7 @@
#include <catch2/internal/catch_enforce.hpp>
#include <catch2/interfaces/catch_interfaces_capture.hpp>
#include <catch2/internal/catch_windows_h_proxy.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#include <algorithm>
diff --git a/src/catch2/internal/catch_output_redirect.cpp b/src/catch2/internal/catch_output_redirect.cpp
index 49cfaa0d..ae060141 100644
--- a/src/catch2/internal/catch_output_redirect.cpp
+++ b/src/catch2/internal/catch_output_redirect.cpp
@@ -7,6 +7,7 @@
// SPDX-License-Identifier: BSL-1.0
#include <catch2/internal/catch_output_redirect.hpp>
#include <catch2/internal/catch_enforce.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#include <cstdio>
#include <cstring>
diff --git a/src/catch2/internal/catch_stdstreams.cpp b/src/catch2/internal/catch_stdstreams.cpp
new file mode 100644
index 00000000..21a0e4e6
--- /dev/null
+++ b/src/catch2/internal/catch_stdstreams.cpp
@@ -0,0 +1,24 @@
+
+// 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
+
+#include <catch2/internal/catch_stdstreams.hpp>
+
+#include <catch2/catch_user_config.hpp>
+
+#include <iostream>
+
+namespace Catch {
+
+// If you #define this you must implement these functions
+#if !defined( CATCH_CONFIG_NOSTDOUT )
+ std::ostream& cout() { return std::cout; }
+ std::ostream& cerr() { return std::cerr; }
+ std::ostream& clog() { return std::clog; }
+#endif
+
+} // namespace Catch
diff --git a/src/catch2/internal/catch_stdstreams.hpp b/src/catch2/internal/catch_stdstreams.hpp
new file mode 100644
index 00000000..39d8bd75
--- /dev/null
+++ b/src/catch2/internal/catch_stdstreams.hpp
@@ -0,0 +1,22 @@
+
+// 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_STDSTREAMS_HPP_INCLUDED
+#define CATCH_STDSTREAMS_HPP_INCLUDED
+
+#include <iosfwd>
+
+namespace Catch {
+
+ std::ostream& cout();
+ std::ostream& cerr();
+ std::ostream& clog();
+
+} // namespace Catch
+
+#endif
diff --git a/src/catch2/internal/catch_stream.cpp b/src/catch2/internal/catch_stream.cpp
index 089a7583..64cfde0a 100644
--- a/src/catch2/internal/catch_stream.cpp
+++ b/src/catch2/internal/catch_stream.cpp
@@ -11,9 +11,9 @@
#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_singletons.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
#include <cstdio>
-#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
@@ -201,12 +201,4 @@ namespace Detail {
}
- ///////////////////////////////////////////////////////////////////////////
-
-
-#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
- std::ostream& cout() { return std::cout; }
- std::ostream& cerr() { return std::cerr; }
- std::ostream& clog() { return std::clog; }
-#endif
}
diff --git a/src/catch2/internal/catch_stream.hpp b/src/catch2/internal/catch_stream.hpp
index eab7161c..d02dc4b1 100644
--- a/src/catch2/internal/catch_stream.hpp
+++ b/src/catch2/internal/catch_stream.hpp
@@ -18,10 +18,6 @@
namespace Catch {
- std::ostream& cout();
- std::ostream& cerr();
- std::ostream& clog();
-
class IStream {
public:
virtual ~IStream(); // = default
diff --git a/src/catch2/reporters/catch_reporter_multi.cpp b/src/catch2/reporters/catch_reporter_multi.cpp
index e8cf7bdf..e7ba7e5d 100644
--- a/src/catch2/reporters/catch_reporter_multi.cpp
+++ b/src/catch2/reporters/catch_reporter_multi.cpp
@@ -9,7 +9,9 @@
#include <catch2/catch_config.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
-#include <catch2/internal/catch_stream.hpp>
+#include <catch2/internal/catch_stdstreams.hpp>
+
+#include <ostream>
namespace Catch {
void MultiReporter::updatePreferences(IEventListener const& reporterish) {