diff --git a/src/run.cpp b/src/run.cpp index f39ce3a..e283a70 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -8,7 +8,7 @@ namespace fuc2 { Options result; int opt = 0; - while((opt = getopt(argc, argv, "fvn:")) != -1) { + while((opt = getopt(argc, argv, "fvm:")) != -1) { switch(opt) { case 'f': result.fail_fast = true; @@ -16,7 +16,7 @@ namespace fuc2 { case 'v': result.verbose = true; break; - case 'n': + case 'm': result.matching = std::string(optarg); break; } @@ -86,6 +86,11 @@ namespace fuc2 { auto opts = parse_options(argc, argv); for(auto& test : tests) { + // skip everything except ones matching the name + if(!test.name.contains(opts.matching)) { + continue; + } + fail_count += run(test, opts, argc > 1); if(opts.fail_fast && fail_count > 0) { diff --git a/tests/sample1.cpp b/tests/sample1.cpp index f5b0eb9..0fc14f9 100644 --- a/tests/sample1.cpp +++ b/tests/sample1.cpp @@ -56,7 +56,7 @@ namespace sample1 { } fuc2::Set TESTS{ - .name="std::deque basic operations", + .name="deque_basic", .options={ .fail_fast=false }, .tests={ TEST(test_push_pop_back), diff --git a/tests/sample_failing.cpp b/tests/sample_failing.cpp index c1c82d8..db7ad55 100644 --- a/tests/sample_failing.cpp +++ b/tests/sample_failing.cpp @@ -36,7 +36,7 @@ namespace sample_failing { } fuc2::Set TESTS{ - .name="std::deque failing ops", + .name="deque_failing", .options={ .fail_fast=false }, .tests={ TEST(fail_push_pop_back),