mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-04 05:09:53 +01:00
Use [#filename] tag for junit testcase classname attribute
If [#filename] is present in tags, use it for the classname attribute, rather than "global". If the test fixture is present that still takes precedence.
This commit is contained in:
parent
a64a0c6f06
commit
a6b03031ba
@ -128,6 +128,13 @@ namespace Catch {
|
||||
xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite.str() ), false );
|
||||
}
|
||||
|
||||
static std::string fileNameTag( const std::set<std::string> &tags ) {
|
||||
std::set<std::string>::const_iterator it = tags.lower_bound("#");
|
||||
if( it != tags.end() && !it->empty() && it->front() == '#' )
|
||||
return it->substr(1);
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void writeTestCase( TestCaseNode const& testCaseNode ) {
|
||||
TestCaseStats const& stats = testCaseNode.value;
|
||||
|
||||
@ -139,6 +146,8 @@ namespace Catch {
|
||||
std::string className = stats.testInfo.className;
|
||||
|
||||
if( className.empty() ) {
|
||||
className = fileNameTag(stats.testInfo.tags);
|
||||
if ( className.empty() )
|
||||
className = "global";
|
||||
}
|
||||
writeSection( className, "", rootSection );
|
||||
|
Loading…
Reference in New Issue
Block a user