Junit reporter uses filename for suite name if no explicit groups

This commit is contained in:
Phil Nash
2012-11-19 19:59:10 +00:00
parent d0cc33f284
commit a90a88adcd
8 changed files with 31 additions and 26 deletions

View File

@@ -199,12 +199,6 @@ namespace Catch {
}
inline void showHelp( const CommandParser& parser ) {
std::string exeName = parser.exeName();
std::string::size_type pos = exeName.find_last_of( "/\\" );
if( pos != std::string::npos ) {
exeName = exeName.substr( pos+1 );
}
AllOptions options;
Options::HelpOptionParser helpOpt;
bool displayedSpecificOption = false;
@@ -226,7 +220,7 @@ namespace Catch {
if( libraryVersion.BranchName != "master" )
std::cout << " (" << libraryVersion.BranchName << " branch)";
std::cout << "\n\n" << exeName << " is a CATCH host application. Options are as follows:\n\n";
std::cout << "\n\n" << parser.exeName() << " is a CATCH host application. Options are as follows:\n\n";
showUsage( std::cout );
}
}

View File

@@ -70,7 +70,11 @@ namespace Catch {
CommandParser( int argc, char const * const * argv ) : m_argc( static_cast<std::size_t>( argc ) ), m_argv( argv ) {}
std::string exeName() const {
return m_argv[0];
std::string exeName = m_argv[0];
std::string::size_type pos = exeName.find_last_of( "/\\" );
if( pos != std::string::npos )
exeName = exeName.substr( pos+1 );
return exeName;
}
Command find( const std::string& arg1, const std::string& arg2, const std::string& arg3 ) const {
return find( arg1 ) + find( arg2 ) + find( arg3 );
@@ -644,6 +648,9 @@ namespace Catch {
}
void parseIntoConfig( const CommandParser& parser, ConfigData& config ) {
config.name = parser.exeName();
if( endsWith( config.name, ".exe" ) )
config.name = config.name.substr( 0, config.name.size()-4 );
for( const_iterator it = m_parsers.begin(); it != m_parsers.end(); ++it )
(*it)->parseIntoConfig( parser, config );
}

View File

@@ -13,7 +13,7 @@
namespace Catch {
// These numbers are maintained by a script
Version libraryVersion = { 0, 9, 4, "integration" };
Version libraryVersion = { 0, 9, 5, "integration" };
}
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@@ -81,7 +81,7 @@ namespace Catch {
virtual void StartGroup( const std::string& groupName ) {
if( groupName.empty() )
m_statsForSuites.push_back( Stats( "all tests" ) );
m_statsForSuites.push_back( Stats( m_config.name ) );
else
m_statsForSuites.push_back( Stats( groupName ) );
m_currentStats = &m_statsForSuites.back();