Am 31.07.24 um 23:03 schrieb Kyle Lippincott: > On Tue, Jul 30, 2024 at 7:07 AM René Scharfe <l.s.r@xxxxxx> wrote: >> >> diff --git a/t/helper/test-example-tap.c b/t/helper/test-example-tap.c >> index d072ad559f..79c12b01cd 100644 >> --- a/t/helper/test-example-tap.c >> +++ b/t/helper/test-example-tap.c >> @@ -72,6 +72,8 @@ static void t_empty(void) >> >> int cmd__example_tap(int argc, const char **argv) >> { >> + check(1); > > Let's include a comment that describes why we have this outside of the > TEST() macros so that people don't try to "fix" it, and so that people > realize it's not meant to be a _good_ example :) Well, the other examples have no such comments, either, but they are tests (using TEST or if_test), so they at least have descriptions. So fair enough. >> diff --git a/t/unit-tests/test-lib.c b/t/unit-tests/test-lib.c >> index 3c513ce59a..989dc758e6 100644 >> --- a/t/unit-tests/test-lib.c >> +++ b/t/unit-tests/test-lib.c >> @@ -264,7 +264,12 @@ static void test_todo(void) >> >> int test_assert(const char *location, const char *check, int ok) >> { >> - assert(ctx.running); >> + if (!ctx.running) { >> + test_msg("BUG: check outside of test at %s", >> + make_relative(location)); > > Below, `test_msg` emits a message like `skipping check '1 == 2' at > <loc>`. Should we include 'check' as part of the message here, or is > it not possible or not useful for some reason? It's possible, of course. Didn't do it because I didn't consider that we might have multiple checks per line and the complementary "test has no checks" message only mentions the line number. The latter is followed by the test description in the next line, though. So yeah, good point. > >> + ctx.failed = 1; >> + return 0; >> + } >> >> if (ctx.result == RESULT_SKIP) { >> test_msg("skipping check '%s' at %s", check, >> -- >> 2.46.0