Test for ~ and removed debug print

This commit is contained in:
Phil Nash 2012-08-24 19:01:35 +01:00
parent f82861fb0a
commit 95ae50ad3d
3 changed files with 10 additions and 3 deletions

View File

@ -131,7 +131,6 @@ namespace Catch {
} }
TestCaseFilters filters( groupName ); TestCaseFilters filters( groupName );
for( std::size_t i = 0; i < cmd.argsCount(); ++i ) { for( std::size_t i = 0; i < cmd.argsCount(); ++i ) {
std::cout << "[" << cmd[i] << "]" << std::endl;
if( startsWith( cmd[i], "exclude:" ) ) if( startsWith( cmd[i], "exclude:" ) )
filters.addFilter( TestCaseFilter( cmd[i].substr( 8 ), IfFilterMatches::ExcludeTests ) ); filters.addFilter( TestCaseFilter( cmd[i].substr( 8 ), IfFilterMatches::ExcludeTests ) );
else if( startsWith( cmd[i], "~" ) ) else if( startsWith( cmd[i], "~" ) )

View File

@ -137,6 +137,15 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
REQUIRE( config.filters[0].shouldInclude( makeTestCase( "alwaysIncluded" ) ) ); REQUIRE( config.filters[0].shouldInclude( makeTestCase( "alwaysIncluded" ) ) );
} }
SECTION( "--test/exclude:2", "Specify one test case exclusion using --test ~" ) {
const char* argv[] = { "test", "--test", "~test1" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
REQUIRE( config.filters.size() == 1 );
REQUIRE( config.filters[0].shouldInclude( makeTestCase( "test1" ) ) == false );
REQUIRE( config.filters[0].shouldInclude( makeTestCase( "alwaysIncluded" ) ) );
}
SECTION( "-t/2", "Specify two test cases using -t" ) { SECTION( "-t/2", "Specify two test cases using -t" ) {
const char* argv[] = { "test", "-t", "test1", "test2" }; const char* argv[] = { "test", "-t", "test1", "test2" };
CHECK_NOTHROW( parseIntoConfig( argv, config ) ); CHECK_NOTHROW( parseIntoConfig( argv, config ) );

View File

@ -1,5 +1,5 @@
/* /*
* Generated: 2012-08-24 18:57:26.838444 * Generated: 2012-08-24 19:01:02.483106
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -2594,7 +2594,6 @@ namespace Catch {
} }
TestCaseFilters filters( groupName ); TestCaseFilters filters( groupName );
for( std::size_t i = 0; i < cmd.argsCount(); ++i ) { for( std::size_t i = 0; i < cmd.argsCount(); ++i ) {
std::cout << "[" << cmd[i] << "]" << std::endl;
if( startsWith( cmd[i], "exclude:" ) ) if( startsWith( cmd[i], "exclude:" ) )
filters.addFilter( TestCaseFilter( cmd[i].substr( 8 ), IfFilterMatches::ExcludeTests ) ); filters.addFilter( TestCaseFilter( cmd[i].substr( 8 ), IfFilterMatches::ExcludeTests ) );
else if( startsWith( cmd[i], "~" ) ) else if( startsWith( cmd[i], "~" ) )