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-06-01 19:40:27 +0100
committerPhil Nash2012-06-01 19:40:27 +0100
commit19b2aa6187092367e2bb57e1288dc48618b235e0 (patch)
tree1e914cbec3f43d0d5b45a1026a1fa73aab0f0d97 /projects/SelfTest/TestMain.cpp
parent163088a11f5b20c561e624c8ed5cdc8e8c0464ef (diff)
downloadcatch3-19b2aa6187092367e2bb57e1288dc48618b235e0.tar.gz
Added cutoff option to command line
Aborts testing after a certain number of assertion failures
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
-rw-r--r--projects/SelfTest/TestMain.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index eba029be..3185e16a 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -74,6 +74,7 @@ TEST_CASE( "selftest/parser", "" ) {
CHECK( config.getTestSpecs().empty() );
CHECK( config.shouldDebugBreak() == false );
CHECK( config.showHelp() == false );
+ CHECK( config.getCutoff() == -1 );
CHECK( dynamic_cast<Catch::BasicReporter*>( config.getReporter().get() ) );
}
@@ -200,4 +201,39 @@ TEST_CASE( "selftest/parser", "" ) {
REQUIRE_THAT( config.getMessage(), Contains( "not accept" ) );
}
}
+
+ SECTION( "cutoff", "" ) {
+ SECTION( "-c", "" ) {
+ const char* argv[] = { "test", "-c" };
+ Catch::Config config;
+ CHECK( parseIntoConfig( argv, config ) );
+
+ REQUIRE( config.getCutoff() == 1 );
+ }
+ SECTION( "-c/2", "" ) {
+ const char* argv[] = { "test", "-c", "2" };
+ Catch::Config config;
+ CHECK( parseIntoConfig( argv, config ) );
+
+ REQUIRE( config.getCutoff() == 2 );
+ }
+ SECTION( "-c/error", "cutoff only takes one argument" ) {
+ const char* argv[] = { "test", "-c", "1", "2" };
+ Catch::Config config;
+ CHECK( parseIntoConfig( argv, config ) == false );
+
+ REQUIRE_THAT( config.getMessage(), Contains( "accepts" ) );
+ }
+ }
+ SECTION( "combinations", "" ) {
+ SECTION( "-c -b", "" ) {
+ const char* argv[] = { "test", "-c", "-b" };
+ Catch::Config config;
+ CHECK( parseIntoConfig( argv, config ) );
+
+ REQUIRE( config.getCutoff() == 1 );
+ REQUIRE( config.shouldDebugBreak() );
+ }
+ }
+
}