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

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-03-23 13:41:04 +0100
committerMartin Hořeňovský2023-03-23 16:50:07 +0100
commitc487b27d9d98e69358f3eee7b02c7d2ad0889139 (patch)
treed1ce88ca653db89272858240faeb5a55f899aabc /src
parent3230760db2094019b2f34929095e8b4e9683e7f8 (diff)
downloadcatch3-c487b27d9d98e69358f3eee7b02c7d2ad0889139.tar.gz
Reduce misc includes all around
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/catch2/catch_tostring.hpp1
-rw-r--r--src/catch2/catch_translate_exception.cpp20
-rw-r--r--src/catch2/catch_translate_exception.hpp10
-rw-r--r--src/catch2/interfaces/catch_interfaces_exception.hpp1
-rw-r--r--src/catch2/internal/catch_assertion_handler.cpp1
-rw-r--r--src/catch2/internal/catch_assertion_handler.hpp3
-rw-r--r--src/catch2/meson.build1
-rw-r--r--src/catch2/reporters/catch_reporter_registrars.cpp1
-rw-r--r--src/catch2/reporters/catch_reporter_registrars.hpp2
10 files changed, 30 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 719413d2..47b7dfe5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -153,6 +153,7 @@ set(IMPL_SOURCES
${SOURCES_DIR}/catch_timer.cpp
${SOURCES_DIR}/catch_tostring.cpp
${SOURCES_DIR}/catch_totals.cpp
+ ${SOURCES_DIR}/catch_translate_exception.cpp
${SOURCES_DIR}/catch_version.cpp
${SOURCES_DIR}/internal/catch_assertion_handler.cpp
${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.cpp
diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp
index 904caa7e..788d824c 100644
--- a/src/catch2/catch_tostring.hpp
+++ b/src/catch2/catch_tostring.hpp
@@ -116,7 +116,6 @@ namespace Catch {
} // namespace Detail
- // If we decide for C++14, change these to enable_if_ts
template <typename T, typename = void>
struct StringMaker {
template <typename Fake = T>
diff --git a/src/catch2/catch_translate_exception.cpp b/src/catch2/catch_translate_exception.cpp
new file mode 100644
index 00000000..c4b28944
--- /dev/null
+++ b/src/catch2/catch_translate_exception.cpp
@@ -0,0 +1,20 @@
+
+// Copyright Catch2 Authors
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt or copy at
+// https://www.boost.org/LICENSE_1_0.txt)
+
+// SPDX-License-Identifier: BSL-1.0
+
+#include <catch2/catch_translate_exception.hpp>
+#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
+
+namespace Catch {
+ namespace Detail {
+ void registerTranslatorImpl(
+ Detail::unique_ptr<IExceptionTranslator>&& translator ) {
+ getMutableRegistryHub().registerTranslator(
+ CATCH_MOVE( translator ) );
+ }
+ } // namespace Detail
+} // namespace Catch
diff --git a/src/catch2/catch_translate_exception.hpp b/src/catch2/catch_translate_exception.hpp
index 2dbeb17e..5a4dc5e3 100644
--- a/src/catch2/catch_translate_exception.hpp
+++ b/src/catch2/catch_translate_exception.hpp
@@ -15,6 +15,10 @@
#include <exception>
namespace Catch {
+ namespace Detail {
+ void registerTranslatorImpl(
+ Detail::unique_ptr<IExceptionTranslator>&& translator );
+ }
class ExceptionTranslatorRegistrar {
template<typename T>
@@ -48,9 +52,9 @@ namespace Catch {
public:
template<typename T>
ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) {
- getMutableRegistryHub().registerTranslator(
- Detail::make_unique<ExceptionTranslator<T>>(translateFunction)
- );
+ Detail::registerTranslatorImpl(
+ Detail::make_unique<ExceptionTranslator<T>>(
+ translateFunction ) );
}
};
diff --git a/src/catch2/interfaces/catch_interfaces_exception.hpp b/src/catch2/interfaces/catch_interfaces_exception.hpp
index 9177666a..fcc2a8f9 100644
--- a/src/catch2/interfaces/catch_interfaces_exception.hpp
+++ b/src/catch2/interfaces/catch_interfaces_exception.hpp
@@ -8,7 +8,6 @@
#ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED
#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED
-#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
#include <string>
diff --git a/src/catch2/internal/catch_assertion_handler.cpp b/src/catch2/internal/catch_assertion_handler.cpp
index c28b6190..b66a1456 100644
--- a/src/catch2/internal/catch_assertion_handler.cpp
+++ b/src/catch2/internal/catch_assertion_handler.cpp
@@ -12,7 +12,6 @@
#include <catch2/internal/catch_debugger.hpp>
#include <catch2/internal/catch_test_failure_exception.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
-#include <catch2/internal/catch_run_context.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
namespace Catch {
diff --git a/src/catch2/internal/catch_assertion_handler.hpp b/src/catch2/internal/catch_assertion_handler.hpp
index ee7188ba..01dd7801 100644
--- a/src/catch2/internal/catch_assertion_handler.hpp
+++ b/src/catch2/internal/catch_assertion_handler.hpp
@@ -11,14 +11,11 @@
#include <catch2/catch_assertion_info.hpp>
#include <catch2/internal/catch_decomposer.hpp>
#include <catch2/interfaces/catch_interfaces_capture.hpp>
-#include <catch2/internal/catch_lazy_expr.hpp>
#include <string>
namespace Catch {
- class IResultCapture;
-
struct AssertionReaction {
bool shouldDebugBreak = false;
bool shouldThrow = false;
diff --git a/src/catch2/meson.build b/src/catch2/meson.build
index fee3b4ed..b5ffc224 100644
--- a/src/catch2/meson.build
+++ b/src/catch2/meson.build
@@ -260,6 +260,7 @@ internal_sources = files(
'catch_timer.cpp',
'catch_tostring.cpp',
'catch_totals.cpp',
+ 'catch_translate_exception.cpp',
'catch_version.cpp',
)
diff --git a/src/catch2/reporters/catch_reporter_registrars.cpp b/src/catch2/reporters/catch_reporter_registrars.cpp
index 17f59517..2a3ac957 100644
--- a/src/catch2/reporters/catch_reporter_registrars.cpp
+++ b/src/catch2/reporters/catch_reporter_registrars.cpp
@@ -8,6 +8,7 @@
#include <catch2/reporters/catch_reporter_registrars.hpp>
+#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp>
namespace Catch {
diff --git a/src/catch2/reporters/catch_reporter_registrars.hpp b/src/catch2/reporters/catch_reporter_registrars.hpp
index cab395f4..a93963f0 100644
--- a/src/catch2/reporters/catch_reporter_registrars.hpp
+++ b/src/catch2/reporters/catch_reporter_registrars.hpp
@@ -8,8 +8,6 @@
#ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
#define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
-#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
-#include <catch2/interfaces/catch_interfaces_reporter.hpp>
#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp>
#include <catch2/internal/catch_unique_name.hpp>