[RFAv2 2/2] Add a selftest that checks documentation invariants.

Tom Tromey tom@tromey.com
Tue Aug 6 18:43:00 GMT 2019

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> gdb/ChangeLog
Philippe> 	* unittests/help-doc-selftests.c: New file.
Philippe> 	* Makefile.in: Add the new file.

Thanks for doing this.

Philippe> +static void
Philippe> +broken_doc_invariant (const char *prefix, const char *name, const char *msg)
Philippe> +{
Philippe> +  fprintf_filtered (gdb_stdout,
Philippe> +		    "help doc broken invariant: command '%s%s' help doc %s\n",
Philippe> +		    prefix, name, msg);

Normally I'd probably complain about being i18n-unfriendly here, but TBH
I don't think that matters much for unit tests.

Philippe> +  /* Walk through the commands.  */
Philippe> +  for (c=commandlist;c;c=c->next)

This needs some spaces.

Philippe> +      while (*p && *p != '\n')
Philippe> +	p++;

I think this could just be "p = strchr (p, '\n')".

This is ok with those things fixed.


More information about the Gdb-patches mailing list