mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
Ensure that help text fits in 80 columns
This patch adds a new unit test that ensures that all help text wraps at 80 columns.
This commit is contained in:
parent
a03d5b9bf3
commit
fba3b6d16c
@ -78,9 +78,10 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
|
|||||||
(prefix, c->name,
|
(prefix, c->name,
|
||||||
"has superfluous trailing whitespace");
|
"has superfluous trailing whitespace");
|
||||||
|
|
||||||
|
const char *prev_start = c->doc;
|
||||||
for (const char *nl = strchr (c->doc, '\n');
|
for (const char *nl = strchr (c->doc, '\n');
|
||||||
nl != nullptr;
|
nl != nullptr;
|
||||||
nl = strchr (nl + 1, '\n'))
|
nl = strchr (prev_start, '\n'))
|
||||||
{
|
{
|
||||||
if (nl == c->doc)
|
if (nl == c->doc)
|
||||||
broken_doc_invariant (prefix, c->name, "has a leading newline");
|
broken_doc_invariant (prefix, c->name, "has a leading newline");
|
||||||
@ -91,8 +92,15 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
|
|||||||
broken_doc_invariant (prefix, c->name,
|
broken_doc_invariant (prefix, c->name,
|
||||||
"has whitespace before a newline");
|
"has whitespace before a newline");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nl - prev_start > cli_help_line_length)
|
||||||
|
broken_doc_invariant (prefix, c->name, "has over-long line");
|
||||||
|
prev_start = nl + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strlen (prev_start) > cli_help_line_length)
|
||||||
|
broken_doc_invariant (prefix, c->name, "has over-long line");
|
||||||
|
|
||||||
/* Check if this command has subcommands and is not an
|
/* Check if this command has subcommands and is not an
|
||||||
abbreviation. We skip checking subcommands of abbreviations
|
abbreviation. We skip checking subcommands of abbreviations
|
||||||
in order to avoid duplicates in the output. */
|
in order to avoid duplicates in the output. */
|
||||||
|
Loading…
Reference in New Issue
Block a user