mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Cleaned up config class a bit
This commit is contained in:
@@ -131,7 +131,7 @@ namespace Catch
|
||||
else
|
||||
return setErrorMode( m_command + " expected [xml] or [text] but recieved: [" + m_args[1] + "]" );
|
||||
}
|
||||
m_config.m_listSpec = (Config::List::What)( m_config.m_listSpec | listSpec );
|
||||
m_config.setListSpec( (Config::List::What)( m_config.getListSpec() | listSpec ) );
|
||||
}
|
||||
break;
|
||||
case modeTest:
|
||||
|
@@ -84,6 +84,24 @@ namespace Catch
|
||||
{
|
||||
m_testSpecs.push_back( testSpec );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
bool testsSpecified() const
|
||||
{
|
||||
return !m_testSpecs.empty();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
const std::vector<std::string>& getTestSpecs() const
|
||||
{
|
||||
return m_testSpecs;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
List::What getListSpec( void ) const
|
||||
{
|
||||
return m_listSpec;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void setListSpec( List::What listSpec )
|
||||
@@ -98,11 +116,17 @@ namespace Catch
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
std::string getFilename()
|
||||
const std::string& getFilename() const
|
||||
{
|
||||
return m_filename;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
const std::string& getMessage() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void setError( const std::string& errorMessage )
|
||||
{
|
||||
@@ -116,19 +140,13 @@ namespace Catch
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
IReporter* getReporter()
|
||||
IReporter* getReporter() const
|
||||
{
|
||||
if( !m_reporter.get() )
|
||||
setReporter( Hub::getReporterRegistry().create( "basic", *this ) );
|
||||
const_cast<Config*>( this )->setReporter( Hub::getReporterRegistry().create( "basic", *this ) );
|
||||
return m_reporter.get();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
IReporter* getReporter() const
|
||||
{
|
||||
return const_cast<Config*>( this )->getReporter();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
List::What listWhat() const
|
||||
{
|
||||
@@ -200,7 +218,7 @@ namespace Catch
|
||||
return m_includeWhat == Include::SuccessfulResults;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::auto_ptr<IReporter> m_reporter;
|
||||
std::string m_filename;
|
||||
std::string m_message;
|
||||
|
@@ -54,7 +54,7 @@ namespace Catch
|
||||
{
|
||||
std::cerr << "Reporters ignored when listing" << std::endl;
|
||||
}
|
||||
if( config.m_testSpecs.size() == 0 )
|
||||
if( !config.testsSpecified() )
|
||||
{
|
||||
std::cerr << "Test specs ignored when listing" << std::endl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user