mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 11:43:29 +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 );
|
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 ) {
|
void writeTestCase( TestCaseNode const& testCaseNode ) {
|
||||||
TestCaseStats const& stats = testCaseNode.value;
|
TestCaseStats const& stats = testCaseNode.value;
|
||||||
|
|
||||||
@ -139,6 +146,8 @@ namespace Catch {
|
|||||||
std::string className = stats.testInfo.className;
|
std::string className = stats.testInfo.className;
|
||||||
|
|
||||||
if( className.empty() ) {
|
if( className.empty() ) {
|
||||||
|
className = fileNameTag(stats.testInfo.tags);
|
||||||
|
if ( className.empty() )
|
||||||
className = "global";
|
className = "global";
|
||||||
}
|
}
|
||||||
writeSection( className, "", rootSection );
|
writeSection( className, "", rootSection );
|
||||||
|
Loading…
Reference in New Issue
Block a user