> 2023-01-12 Bruno Haible <br...@clisp.org> > > verror: Add tests. > * tests/test-verror.sh: New file, based on tests/test-error.sh. > * tests/test-verror.c: New file, based on tests/test-error.c. > * modules/verror-tests: New file. > > 2023-01-12 Bruno Haible <br...@clisp.org> > > error: Add tests. > * tests/test-error.sh: New file. > * tests/test-error.c: New file. > * modules/error-tests: New file.
Note that the tests do *not* test the situation of error_at_line with a NULL file name argument, since this is not described as supported in the glibc documentation. 2023-01-12 Bruno Haible <br...@clisp.org> error, verror tests: Add clarification. * tests/test-error.c (main): Clarify why we don't test error_at_line with a NULL filename. * tests/test-verror.c (main): Clarify why we don't test verror_at_line with a NULL filename. diff --git a/tests/test-error.c b/tests/test-error.c index 67600d34f9..697e783eee 100644 --- a/tests/test-error.c +++ b/tests/test-error.c @@ -66,6 +66,10 @@ main (int argc, char *argv[]) error_print_progname = print_no_progname; error (0, 0, "hammer"); error (0, 0, "boing %d%d%d is too large", 1, 2, 3); + #if 0 + /* The documentation does not describe the output if the file name is NULL. */ + error_at_line (0, 0, NULL, 42, "drummer too loud"); + #endif error_at_line (0, 0, "d2/bar.c", 11, "bark too loud"); /* Verify error_message_count. */ ASSERT (error_message_count == 11); diff --git a/tests/test-verror.c b/tests/test-verror.c index c5a62cddec..7c808d7908 100644 --- a/tests/test-verror.c +++ b/tests/test-verror.c @@ -109,6 +109,10 @@ main (int argc, char *argv[]) error_print_progname = print_no_progname; test_zero ("hammer"); test_zero ("boing %d%d%d is too large", 1, 2, 3); + #if 0 + /* The documentation does not describe the output if the file name is NULL. */ + test_zero_at_line (NULL, 42, "drummer too loud"); + #endif test_zero_at_line ("d2/bar.c", 11, "bark too loud"); /* Verify error_message_count. */ ASSERT (error_message_count == 11);