From 28a33497be6c6d18d9fc6e2e4cfe6ce7b50680be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 18 Jun 2021 23:36:08 +0200 Subject: [PATCH] Move extractClassName to the single calling TU and make it static --- .../internal/catch_test_case_registry_impl.cpp | 14 -------------- .../internal/catch_test_case_registry_impl.hpp | 3 --- src/catch2/internal/catch_test_registry.cpp | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/catch2/internal/catch_test_case_registry_impl.cpp b/src/catch2/internal/catch_test_case_registry_impl.cpp index f6808e4a..6ce7a1ad 100644 --- a/src/catch2/internal/catch_test_case_registry_impl.cpp +++ b/src/catch2/internal/catch_test_case_registry_impl.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -149,17 +148,4 @@ namespace { m_testAsFunction(); } - std::string extractClassName( StringRef classOrQualifiedMethodName ) { - std::string className(classOrQualifiedMethodName); - if( startsWith( className, '&' ) ) - { - std::size_t lastColons = className.rfind( "::" ); - std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); - if( penultimateColons == std::string::npos ) - penultimateColons = 1; - className = className.substr( penultimateColons, lastColons-penultimateColons ); - } - return className; - } - } // end namespace Catch diff --git a/src/catch2/internal/catch_test_case_registry_impl.hpp b/src/catch2/internal/catch_test_case_registry_impl.hpp index 383512af..60a8f9bd 100644 --- a/src/catch2/internal/catch_test_case_registry_impl.hpp +++ b/src/catch2/internal/catch_test_case_registry_impl.hpp @@ -63,9 +63,6 @@ namespace Catch { void invoke() const override; }; - - std::string extractClassName( StringRef classOrQualifiedMethodName ); - /////////////////////////////////////////////////////////////////////////// diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp index e4ebc2dd..c0965daa 100644 --- a/src/catch2/internal/catch_test_registry.cpp +++ b/src/catch2/internal/catch_test_registry.cpp @@ -10,9 +10,26 @@ #include #include #include +#include namespace Catch { + namespace { + std::string extractClassName( StringRef classOrQualifiedMethodName ) { + std::string className( classOrQualifiedMethodName ); + if ( startsWith( className, '&' ) ) { + std::size_t lastColons = className.rfind( "::" ); + std::size_t penultimateColons = + className.rfind( "::", lastColons - 1 ); + if ( penultimateColons == std::string::npos ) + penultimateColons = 1; + className = className.substr( penultimateColons, + lastColons - penultimateColons ); + } + return className; + } + } // namespace + Detail::unique_ptr makeTestInvoker( void(*testAsFunction)() ) { return Detail::make_unique( testAsFunction ); }