From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/4] Ensure that help text fits in 80 columns
Date: Mon, 03 Jun 2024 11:57:31 -0600 [thread overview]
Message-ID: <20240603-doc-string-cols-v1-4-ad67124ba872@adacore.com> (raw)
In-Reply-To: <20240603-doc-string-cols-v1-0-ad67124ba872@adacore.com>
This patch adds a new unit test that ensures that all help text wraps
at 80 columns.
---
gdb/unittests/command-def-selftests.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c
index 6a9b194e680..a87ce2c5603 100644
--- a/gdb/unittests/command-def-selftests.c
+++ b/gdb/unittests/command-def-selftests.c
@@ -78,6 +78,7 @@ 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'))
@@ -91,6 +92,10 @@ 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;
}
/* Check if this command has subcommands and is not an
--
2.44.0
prev parent reply other threads:[~2024-06-03 17:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 17:57 [PATCH 0/4] Require help text to fit " Tom Tromey
2024-06-03 17:57 ` [PATCH 1/4] Call gdbpy_fix_doc_string_indentation for function help Tom Tromey
2024-06-03 17:57 ` [PATCH 2/4] Wrap help strings at 80 columns Tom Tromey
2024-06-05 15:11 ` Metzger, Markus T
2024-06-07 16:50 ` Tom Tromey
2024-06-03 17:57 ` [PATCH 3/4] Wrap help options when building help string Tom Tromey
2024-06-03 17:57 ` Tom Tromey [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240603-doc-string-cols-v1-4-ad67124ba872@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).