diff options
| author | Phil Nash | 2012-06-03 19:03:17 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-06-03 19:03:17 +0100 |
| commit | 535edcb73b851c0504622b1dc4f16bbfe0f3630b (patch) | |
| tree | ce1aeee296b00945cb658956e6178847950657ad /include | |
| parent | 8d02b9306dd0abbdc44803d03537f266d83bb548 (diff) | |
| download | catch3-535edcb73b851c0504622b1dc4f16bbfe0f3630b.tar.gz | |
changed remaining cmd line checks to cmd.raiseError
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_commandline.hpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index e7195d2f..ac40d092 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -94,7 +94,7 @@ namespace Catch { try { if( Command cmd = parser.find( "-l", "--list" ) ) { if( cmd.argsCount() > 2 ) - throw std::domain_error( cmd.name() + " expected upto 2 arguments but recieved: " ); + cmd.raiseError( "Expected upto 2 arguments" ); List::What listSpec = List::All; if( cmd.argsCount() >= 1 ) { @@ -103,7 +103,7 @@ namespace Catch { else if( cmd[0] == "reporters" ) listSpec = List::Reports; else - throw std::domain_error( cmd.name() + " expected [tests] or [reporters] but recieved: : " ); + cmd.raiseError( "Expected [tests] or [reporters]" ); } if( cmd.argsCount() >= 2 ) { if( cmd[1] == "xml" ) @@ -111,14 +111,14 @@ namespace Catch { else if( cmd[1] == "text" ) listSpec = static_cast<List::What>( listSpec | List::AsText ); else - throw std::domain_error( cmd.name() + " expected [xml] or [text] but recieved: " ); + cmd.raiseError( "Expected [xml] or [text]" ); } config.setListSpec( static_cast<List::What>( config.getListSpec() | listSpec ) ); } if( Command cmd = parser.find( "-t", "--test" ) ) { if( cmd.argsCount() == 0 ) - throw std::domain_error( cmd.name() + " expected at least 1 argument but recieved none" ); + cmd.raiseError( "Expected at least one argument" ); for( std::size_t i = 0; i < cmd.argsCount(); ++i ) config.addTestSpec( cmd[i] ); } @@ -131,7 +131,7 @@ namespace Catch { if( Command cmd = parser.find( "-o", "--out" ) ) { if( cmd.argsCount() == 0 ) - throw std::domain_error( cmd.name() + " expected filename" ); + cmd.raiseError( "Expected filename" ); if( cmd[0][0] == '%' ) config.useStream( cmd[0].substr( 1 ) ); else @@ -140,31 +140,31 @@ namespace Catch { if( Command cmd = parser.find( "-s", "--success" ) ) { if( cmd.argsCount() != 0 ) - throw std::domain_error( cmd.name() + " does not accept arguments" ); + cmd.raiseError( "Does not accept arguments" ); config.setIncludeWhichResults( Include::SuccessfulResults ); } if( Command cmd = parser.find( "-b", "--break" ) ) { if( cmd.argsCount() != 0 ) - throw std::domain_error( cmd.name() + " does not accept arguments" ); + cmd.raiseError( "Does not accept arguments" ); config.setShouldDebugBreak( true ); } if( Command cmd = parser.find( "-n", "--name" ) ) { if( cmd.argsCount() != 1 ) - throw std::domain_error( cmd.name() + " requires exactly one argument (a name)" ); + cmd.raiseError( "Expected a name" ); config.setName( cmd[0] ); } if( Command cmd = parser.find( "-h", "-?", "--help" ) ) { if( cmd.argsCount() != 0 ) - throw std::domain_error( cmd.name() + " does not accept arguments" ); + cmd.raiseError( "Does not accept arguments" ); config.setShowHelp( true ); } if( Command cmd = parser.find( "-a", "--abort" ) ) { if( cmd.argsCount() > 1 ) - throw std::domain_error( cmd.name() + " only accepts 0-1 arguments" ); + cmd.raiseError( "Only accepts 0-1 arguments" ); int threshold = 1; if( cmd.argsCount() == 1 ) { |