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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-06-18 23:36:08 +0200
committerMartin Hořeňovský2021-06-18 23:39:07 +0200
commit28a33497be6c6d18d9fc6e2e4cfe6ce7b50680be (patch)
tree3edf2c7d2107e60e9fb52f97192071ac34dc1118 /src/catch2/internal
parent70f53922102bc3b19b01fc9e1423be77b38170f4 (diff)
downloadcatch3-28a33497be6c6d18d9fc6e2e4cfe6ce7b50680be.tar.gz
Move extractClassName to the single calling TU and make it static
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_test_case_registry_impl.cpp14
-rw-r--r--src/catch2/internal/catch_test_case_registry_impl.hpp3
-rw-r--r--src/catch2/internal/catch_test_registry.cpp17
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 <catch2/interfaces/catch_interfaces_registry_hub.hpp>
#include <catch2/internal/catch_random_number_generator.hpp>
#include <catch2/internal/catch_run_context.hpp>
-#include <catch2/internal/catch_string_manip.hpp>
#include <catch2/catch_test_case_info.hpp>
#include <catch2/catch_test_spec.hpp>
@@ -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 <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>
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<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {
return Detail::make_unique<TestInvokerAsFunction>( testAsFunction );
}