mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-22 20:45:39 +02:00
merge from upstream
This commit is contained in:
@@ -144,9 +144,8 @@ namespace Catch {
|
||||
|
||||
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||
try {
|
||||
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
||||
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
||||
if( unusedOptionBehaviour == OnUnusedOptions::Fail )
|
||||
enforceNoUsedTokens();
|
||||
if( m_configData.showHelp )
|
||||
showHelp( m_configData.processName );
|
||||
m_config.reset();
|
||||
@@ -154,7 +153,7 @@ namespace Catch {
|
||||
catch( std::exception& ex ) {
|
||||
{
|
||||
Colour colourGuard( Colour::Red );
|
||||
std::cerr << "\nError in input:\n"
|
||||
std::cerr << "\nError(s) in input:\n"
|
||||
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
||||
<< "\n\n";
|
||||
}
|
||||
@@ -169,18 +168,6 @@ namespace Catch {
|
||||
m_config.reset();
|
||||
}
|
||||
|
||||
void enforceNoUsedTokens() const {
|
||||
if( !m_unusedTokens.empty() ) {
|
||||
std::vector<Clara::Parser::Token>::const_iterator
|
||||
it = m_unusedTokens.begin(),
|
||||
itEnd = m_unusedTokens.end();
|
||||
std::string msg;
|
||||
for(; it != itEnd; ++it )
|
||||
msg += " unrecognised option: " + it->data + "\n";
|
||||
throw std::runtime_error( msg.substr( 0, msg.size()-1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
int run( int argc, char* const argv[] ) {
|
||||
|
||||
int returnCode = applyCommandLine( argc, argv );
|
||||
|
Reference in New Issue
Block a user