@@ -346,7 +346,8 @@ void TestFixture::printHelp()
346346 " -q Do not print the test cases that have run.\n "
347347 " -h, --help Print this help.\n "
348348 " -n Print no summaries.\n "
349- " -d Do not execute the tests.\n " ;
349+ " -d Do not execute any tests (dry run).\n "
350+ " -x Exclude the specified tests.\n " ;
350351}
351352
352353void TestFixture::run (const std::string &str)
@@ -392,16 +393,21 @@ std::size_t TestFixture::runTests(const options& args)
392393 std::string testname;
393394 const std::string::size_type pos = classname.find (" ::" );
394395 if (pos != std::string::npos) {
396+ // TODO: excluding indiviual tests is not supported yet
395397 testname = classname.substr (pos + 2 );
396398 classname.erase (pos);
397399 }
398400
399401 for (TestInstance * test : TestRegistry::theInstance ().tests ()) {
400- if (classname.empty () || test-> classname == classname ) {
401- TestFixture* fixture = test->create () ;
402- fixture-> processOptions ( args);
403- fixture-> run (testname) ;
402+ if (! classname.empty ()) {
403+ const bool match = test->classname == classname ;
404+ if ((match && args. exclude_tests ()) || (!match && !args. exclude_tests ()))
405+ continue ;
404406 }
407+
408+ TestFixture* fixture = test->create ();
409+ fixture->processOptions (args);
410+ fixture->run (testname);
405411 }
406412 }
407413
0 commit comments