diff --git a/include/criterion/criterion.h b/include/criterion/criterion.h index 1fae07a..48b3dcf 100644 --- a/include/criterion/criterion.h +++ b/include/criterion/criterion.h @@ -17,6 +17,7 @@ # define Test_(Category, Name, ...) \ TEST_PROTOTYPE_(Category, Name); \ struct criterion_test_extra_data IDENTIFIER_(Category, Name, extra) = { \ + .identifier_ = #Category "/" #Name, \ .file_ = __FILE__, \ .line_ = __LINE__, \ __VA_ARGS__ \ diff --git a/include/criterion/types.h b/include/criterion/types.h index 08aadf1..55c36ac 100644 --- a/include/criterion/types.h +++ b/include/criterion/types.h @@ -29,6 +29,7 @@ struct criterion_test_extra_data { int sentinel_; + const char *const identifier_; const char *const file_; const unsigned line_; void (*init)(void); diff --git a/src/report.c b/src/report.c index 1b86678..5c70807 100644 --- a/src/report.c +++ b/src/report.c @@ -59,12 +59,8 @@ IMPL_REPORT_HOOK(PRE_ALL)(struct criterion_test_set *set) { continue; FOREACH_SET(struct criterion_test *test, s->tests) { - char *name = NULL; - asprintf(&name, "%s/%s", s->suite.name, test->name); - if (fnmatch(criterion_options.pattern, name, 0)) + if (fnmatch(criterion_options.pattern, test->data->identifier_, 0)) test->data->disabled = true; - - free(name); } } }