WIldcards at both ends

This commit is contained in:
Phil Nash
2012-08-24 08:23:50 +01:00
parent 56d5c42912
commit 4c97fc5619
6 changed files with 141 additions and 66 deletions

View File

@@ -251,7 +251,7 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
}
}
TEST_CASE( "selftest/test filter", "Groups of tests can be selected" ) {
TEST_CASE( "selftest/test filter", "Individual filters" ) {
Catch::TestCaseFilter matchAny( "*" );
Catch::TestCaseFilter matchNone( "*", Catch::IfFilterMatches::ExcludeTests );
@@ -268,7 +268,7 @@ TEST_CASE( "selftest/test filter", "Groups of tests can be selected" ) {
CHECK( matchNonHidden.shouldInclude( makeTestCase( "./any" ) ) == false );
}
TEST_CASE( "selftest/test filters", "Groups of tests can be selected" ) {
TEST_CASE( "selftest/test filters", "Sets of filters" ) {
Catch::TestCaseFilter matchHidden( "./*" );
Catch::TestCaseFilter dontMatchA( "./a*", Catch::IfFilterMatches::ExcludeTests );
@@ -282,3 +282,18 @@ TEST_CASE( "selftest/test filters", "Groups of tests can be selected" ) {
CHECK( filters.shouldInclude( makeTestCase( "./something" ) ) );
CHECK( filters.shouldInclude( makeTestCase( "./anything" ) ) == false );
}
TEST_CASE( "selftest/filter/prefix wildcard", "Individual filters with wildcards at the start" ) {
Catch::TestCaseFilter matchBadgers( "*badger" );
CHECK( matchBadgers.shouldInclude( makeTestCase( "big badger" ) ));
CHECK( matchBadgers.shouldInclude( makeTestCase( "little badgers" ) ) == false );
}
TEST_CASE( "selftest/filter/wildcard at both ends", "Individual filters with wildcards at both ends" ) {
Catch::TestCaseFilter matchBadgers( "*badger*" );
CHECK( matchBadgers.shouldInclude( makeTestCase( "big badger" ) ));
CHECK( matchBadgers.shouldInclude( makeTestCase( "little badgers" ) ) );
CHECK( matchBadgers.shouldInclude( makeTestCase( "badgers are big" ) ) );
CHECK( matchBadgers.shouldInclude( makeTestCase( "hedgehogs" ) ) == false );
}