[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