This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] Make first and last lines of 'command help documentation' consistent.
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 11 Jul 2019 00:31:38 +0200
- Subject: Re: [RFA] Make first and last lines of 'command help documentation' consistent.
- References: <firstname.lastname@example.org> <email@example.com>
On Wed, 2019-07-10 at 11:02 -0600, Tom Tromey wrote:
> Philippe> + /* Checks that the documentation does not help with a new line.
> Philippe> + If it does, output a special marker string that gdb.base/help.exp
> Philippe> + will detect. */
> Philippe> + if (c->doc[strlen (c->doc) - 1] == '\n')
> Philippe> + fprintf_filtered (stream, "END_OF_LINE@END_OF_DOC %s%s\n",
> Philippe> + prefix, c->name);
> I think this can't be an assertion, because user commands could hit it,
> and that seems too harsh; but could it be a unit test? That might be
> better than printing something magic, especially since IIUC the user can
> end up seeing this stuff.
Effectively, the user can end up seeing this, but only if the GDB test
was not run and/or was not fixed.
> Philippe> +gdb_test_no_output \
> Philippe> + "|apropos .| grep -e '\[^\.\]$' -e '^END_OF_LINE@END_OF_DOC '" \
> Philippe> + "command help doc first line ends with a dot, doc does not end with eol"
> I'm not sure we can rely on having grep in the test suite. If you
> switch the patch to a self-test, then this is moot; otherwise, is this
> used elsewhere? I think a different approach is to write to a log file
> and then examine it with Tcl. I believe some other tests do this.
The testsuite uses various unix commands such as mv/touch/grep/stty/...
But maybe these tests are all failing e.g. on windows ?
In any case, I will see if it is easy to do a selftest instead,
without duplicating too much of e.g. the recursive traversal of the commands,
maybe by adding a 'for_self_test' boolean arg to apropos_command ...
Thanks for the comments,