Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/TestMain.cpp
diff options
context:
space:
mode:
authorPhil Nash2012-07-28 20:22:40 +0100
committerPhil Nash2012-07-28 20:22:40 +0100
commitb084562b3bd213da3cd9e422a2343073d8e34d11 (patch)
treed0539135542657b203ffdf46e00dc7e9e681a824 /projects/SelfTest/TestMain.cpp
parent6f220863cf7da867d9d897fd7fb346b20cc48f0e (diff)
downloadcatch3-b084562b3bd213da3cd9e422a2343073d8e34d11.tar.gz
Improved error handling for --abort as per #108
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
-rw-r--r--projects/SelfTest/TestMain.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 599edf4f..15616ee3 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -68,6 +68,7 @@ template<size_t size>
std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::ConfigData& config ) {
try {
Catch::parseIntoConfig( Catch::CommandParser( size, argv ), config );
+ FAIL( "expected exception" );
}
catch( std::exception& ex ) {
return ex.what();
@@ -179,7 +180,15 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
REQUIRE( config.cutoff == 2 );
}
- SECTION( "-a/error", "cutoff only takes one argument" ) {
+ SECTION( "-a/error/0", "" ) {
+ const char* argv[] = { "test", "-a", "0" };
+ REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" ) );
+ }
+ SECTION( "-a/error/non numeric", "" ) {
+ const char* argv[] = { "test", "-a", "oops" };
+ REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" ) );
+ }
+ SECTION( "-a/error/two args", "cutoff only takes one argument" ) {
const char* argv[] = { "test", "-a", "1", "2" };
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "accepts" ) );
}