diff options
author | Tom Tromey <tromey@adacore.com> | 2024-06-03 09:40:47 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-11-11 07:45:02 -0700 |
commit | fba3b6d16c206882c3ccb98da38271cf36100629 (patch) | |
tree | fb9c8cfe985b1ee3d32480bd20075be95fbaff80 | |
parent | a03d5b9bf375452fadb34b27638be3951c3f482e (diff) | |
download | gdb-fba3b6d16c206882c3ccb98da38271cf36100629.zip gdb-fba3b6d16c206882c3ccb98da38271cf36100629.tar.gz gdb-fba3b6d16c206882c3ccb98da38271cf36100629.tar.bz2 |
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.
-rw-r--r-- | gdb/unittests/command-def-selftests.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c index 6a9b194..cf51f0d 100644 --- a/gdb/unittests/command-def-selftests.c +++ b/gdb/unittests/command-def-selftests.c @@ -78,9 +78,10 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix) (prefix, c->name, "has superfluous trailing whitespace"); + const char *prev_start = c->doc; for (const char *nl = strchr (c->doc, '\n'); nl != nullptr; - nl = strchr (nl + 1, '\n')) + nl = strchr (prev_start, '\n')) { if (nl == c->doc) 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, "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 abbreviation. We skip checking subcommands of abbreviations in order to avoid duplicates in the output. */ |