summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-06-03 15:40:37 +0200
committerGitHub <noreply@github.com>2020-06-03 15:40:37 +0200
commit86b85492b1bc8eeb9ff1af25b92877969f17833a (patch)
treea2aa7d4c53d23d81f456816f16a281e65cc21d3f
parent53a8f4631ea695d8bd4aa2a5b762adc13c6a806d (diff)
parent0d3ce2ac3f21f7b1af02c64a6c2ba0e9e59eea29 (diff)
downloadlibgit2-86b85492b1bc8eeb9ff1af25b92877969f17833a.tar.gz
Merge pull request #5537 from libgit2/ethomson/clar_exactmatch
tests: offer exact name matching with a `$` suffix
-rw-r--r--tests/clar.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/clar.c b/tests/clar.c
index ead13f46a..69283b86b 100644
--- a/tests/clar.c
+++ b/tests/clar.c
@@ -293,6 +293,7 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
const struct clar_func *test = suite->tests;
size_t i, matchlen;
struct clar_report *report;
+ int exact = 0;
if (!suite->enabled)
return;
@@ -317,6 +318,11 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
while (*filter == ':')
++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)
if (filter && strncmp(test[i].name, filter, matchlen))
continue;
+ if (exact && strlen(test[i].name) != matchlen)
+ continue;
+
_clar.active_test = test[i].name;
report = calloc(1, sizeof(struct clar_report));