mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 13:55:39 +02:00
Normalize C++ namespace in JUnit's reporter classname field
Closes #2468
This commit is contained in:
@@ -67,6 +67,15 @@ namespace Catch {
|
||||
return rss.str();
|
||||
}
|
||||
|
||||
static void normalizeNamespaceMarkers(std::string& str) {
|
||||
std::size_t pos = str.find( "::" );
|
||||
while ( pos != str.npos ) {
|
||||
str.replace( pos, 2, "." );
|
||||
pos += 1;
|
||||
pos = str.find( "::", pos );
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
JunitReporter::JunitReporter( ReporterConfig&& _config )
|
||||
@@ -170,6 +179,8 @@ namespace Catch {
|
||||
if ( !m_config->name().empty() )
|
||||
className = static_cast<std::string>(m_config->name()) + '.' + className;
|
||||
|
||||
normalizeNamespaceMarkers(className);
|
||||
|
||||
writeSection( className, "", rootSection, stats.testInfo->okToFail() );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user