Reduce internal includes

This commit is contained in:
Martin Hořeňovský 2023-03-14 23:00:59 +01:00
parent 6783411349
commit 62167d756e
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
3 changed files with 16 additions and 22 deletions

View File

@ -9,6 +9,7 @@
#include <catch2/internal/catch_context.hpp>
#include <catch2/internal/catch_enforce.hpp>
#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_random_number_generator.hpp>
#include <catch2/internal/catch_run_context.hpp>
@ -142,11 +143,4 @@ namespace Catch {
return m_sortedFunctions;
}
///////////////////////////////////////////////////////////////////////////
void TestInvokerAsFunction::invoke() const {
m_testAsFunction();
}
} // end namespace Catch

View File

@ -8,8 +8,9 @@
#ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
#define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
#include <catch2/internal/catch_test_registry.hpp>
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
#include <vector>
@ -53,18 +54,6 @@ namespace Catch {
///////////////////////////////////////////////////////////////////////////
class TestInvokerAsFunction final : public ITestInvoker {
using TestType = void(*)();
TestType m_testAsFunction;
public:
TestInvokerAsFunction(TestType testAsFunction) noexcept:
m_testAsFunction(testAsFunction) {}
void invoke() const override;
};
///////////////////////////////////////////////////////////////////////////
} // end namespace Catch

View File

@ -8,7 +8,6 @@
#include <catch2/internal/catch_test_registry.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp>
#include <catch2/catch_test_case_info.hpp>
#include <catch2/internal/catch_test_case_registry_impl.hpp>
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_string_manip.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
@ -19,7 +18,7 @@
namespace Catch {
namespace {
StringRef extractClassName( StringRef classOrMethodName ) {
static StringRef extractClassName( StringRef classOrMethodName ) {
if ( !startsWith( classOrMethodName, '&' ) ) {
return classOrMethodName;
}
@ -46,6 +45,18 @@ namespace Catch {
static_cast<std::size_t>( startIdx ),
static_cast<std::size_t>( classNameSize ) );
}
class TestInvokerAsFunction final : public ITestInvoker {
using TestType = void ( * )();
TestType m_testAsFunction;
public:
TestInvokerAsFunction( TestType testAsFunction ) noexcept:
m_testAsFunction( testAsFunction ) {}
void invoke() const override { m_testAsFunction(); }
};
} // namespace
Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {