mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-02 02:03:30 +01:00
trim test/ section names in xml reporter
- BDD-style test names have leading spaces for alignment in the console reporter
This commit is contained in:
parent
ef95020239
commit
a1e87a4b7d
@ -57,16 +57,6 @@ namespace Catch {
|
|||||||
delete it->second;
|
delete it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ContainerT, typename Function>
|
|
||||||
inline void forEach( ContainerT& container, Function function ) {
|
|
||||||
std::for_each( container.begin(), container.end(), function );
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ContainerT, typename Function>
|
|
||||||
inline void forEach( ContainerT const& container, Function function ) {
|
|
||||||
std::for_each( container.begin(), container.end(), function );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool startsWith( std::string const& s, std::string const& prefix );
|
bool startsWith( std::string const& s, std::string const& prefix );
|
||||||
bool endsWith( std::string const& s, std::string const& suffix );
|
bool endsWith( std::string const& s, std::string const& suffix );
|
||||||
bool contains( std::string const& s, std::string const& infix );
|
bool contains( std::string const& s, std::string const& infix );
|
||||||
|
@ -59,7 +59,7 @@ namespace Catch {
|
|||||||
virtual void StartSection( const std::string& sectionName, const std::string& description ) {
|
virtual void StartSection( const std::string& sectionName, const std::string& description ) {
|
||||||
if( m_sectionDepth++ > 0 ) {
|
if( m_sectionDepth++ > 0 ) {
|
||||||
m_xml.startElement( "Section" )
|
m_xml.startElement( "Section" )
|
||||||
.writeAttribute( "name", sectionName )
|
.writeAttribute( "name", trim( sectionName ) )
|
||||||
.writeAttribute( "description", description );
|
.writeAttribute( "description", description );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
|
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
|
||||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", testInfo.name );
|
m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) );
|
||||||
m_currentTestSuccess = true;
|
m_currentTestSuccess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user