mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Move extractClassName to the single calling TU and make it static
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -63,9 +63,6 @@ namespace Catch {
 | 
			
		||||
        void invoke() const override;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    std::string extractClassName( StringRef classOrQualifiedMethodName );
 | 
			
		||||
 | 
			
		||||
    ///////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 );
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user