Unverified Commit 86b85492 by Patrick Steinhardt Committed by GitHub

Merge pull request #5537 from libgit2/ethomson/clar_exactmatch

tests: offer exact name matching with a `$` suffix
parents 53a8f463 0d3ce2ac
...@@ -293,6 +293,7 @@ clar_run_suite(const struct clar_suite *suite, const char *filter) ...@@ -293,6 +293,7 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
const struct clar_func *test = suite->tests; const struct clar_func *test = suite->tests;
size_t i, matchlen; size_t i, matchlen;
struct clar_report *report; struct clar_report *report;
int exact = 0;
if (!suite->enabled) if (!suite->enabled)
return; return;
...@@ -317,6 +318,11 @@ clar_run_suite(const struct clar_suite *suite, const char *filter) ...@@ -317,6 +318,11 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
while (*filter == ':') while (*filter == ':')
++filter; ++filter;
matchlen = strlen(filter); matchlen = strlen(filter);
if (matchlen && filter[matchlen - 1] == '$') {
exact = 1;
matchlen--;
}
} }
} }
...@@ -324,6 +330,9 @@ clar_run_suite(const struct clar_suite *suite, const char *filter) ...@@ -324,6 +330,9 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
if (filter && strncmp(test[i].name, filter, matchlen)) if (filter && strncmp(test[i].name, filter, matchlen))
continue; continue;
if (exact && strlen(test[i].name) != matchlen)
continue;
_clar.active_test = test[i].name; _clar.active_test = test[i].name;
report = calloc(1, sizeof(struct clar_report)); report = calloc(1, sizeof(struct clar_report));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment