git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/2] test-lib: document test_seq's "-f" option

From
Jeff King <peff@peff.net>
Date
Jun 24, 2025, 10:11 UTC
Message-ID
<20250624101124.GB636332@coredump.intra.peff.net>
In-Reply-To
<oai7p5xmq3q7c3ovdpmbyimoidvgw4lhxfd727qdid5ulcdn3n@7n6vqa6wn3pe>
On Mon, Jun 23, 2025 at 11:25:20AM -0500, Justin Tobler wrote:
Show 18 quoted lines
> > diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> > index bee4a2ca34..8c176f4efc 100644
> > --- a/t/test-lib-functions.sh
> > +++ b/t/test-lib-functions.sh
> > @@ -1454,6 +1454,13 @@ test_cmp_fspath () {
> >  # from 1.
> >  
> >  test_seq () {
> > +	local fmt="%d"
> > +	case "$1" in
> > +	-f)
> > +		fmt="$2"
> 
> With the `-f` option, the default format string gets overwritten to what
> is provided by the user. Makes sense.
> 
> If we want, we could update the comment above this function to mention
> this new option.
Good point. I didn't even notice that comment!

Perhaps we should squash this in? I don't think there's any need to keep it as a separate commit.

-- >8 --
Subject: [PATCH] test-lib: document test_seq's "-f" option

The previous commit added the "-f" option, but didn't mention it in the function's documentation.

Suggested-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
 t/test-lib-functions.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 8c176f4efc..6230746cc4 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1451,7 +1451,12 @@ test_cmp_fspath () {
 #     test_seq 1 5 -- outputs 1 2 3 4 5 one line at a time
 #
 # or with one argument (end), in which case it starts counting
-# from 1.
+# from 1. In addition to the start/end arguments, you can pass an optional
+# printf format. For example:
+#
+#     test_seq -f "line %d" 1 5
+#
+# would print 5 lines, "line 1" through "line 5".
 
 test_seq () {
 	local fmt="%d"
-- 
2.50.0.399.g566d3d7b27
Previous: Justin ToblerNext: Justin Tobler
Message 8 of 14 in “test_seq format option”
  1. 0/2 test_seq format optionJeff King, Jun 23, 2025
  2. 1/2 t7422: replace confusing printf with echoJeff King, Jun 23, 2025
  3. Eric SunshineJun 23, 2025
  4. Jeff KingJun 24, 2025
  5. 2/2 test-lib: teach test_seq the -f optionJeff King, Jun 23, 2025
  6. Junio C HamanoJun 23, 2025
  7. Justin ToblerJun 23, 2025
  8. 3/2 test-lib: document test_seq's "-f" optionJeff King, Jun 24, 2025
  9. Justin ToblerJun 25, 2025
  10. Todd ZullingerJun 23, 2025
  11. Jeff KingJun 24, 2025
  12. Todd ZullingerJun 24, 2025
  13. Eric SunshineJun 24, 2025
  14. Jeff KingJun 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.