All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH 1/3] t7800: improve test descriptions with empty arguments
Date: Thu, 21 Mar 2024 14:47:24 +0100	[thread overview]
Message-ID: <fd37c2931904bc64fb6ea14331aea60278f495eb.1711028473.git.ps@pks.im> (raw)
In-Reply-To: <cover.1711028473.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 3452 bytes --]

Some of the tests in t7800 are executed repeatedly in a loop with
different arguments. To distinguish these tests, the value of that
variable is rendered into the test title. But given that one of the
values is the empty string, it results in a somewhat awkward test name:

    difftool  ignores exit code

Improve this by printing "without options" in case the value is empty.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t7800-difftool.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 96ae5d5880..80bf108f54 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -93,40 +93,40 @@ test_expect_success 'difftool forwards arguments to diff' '
 
 for opt in '' '--dir-diff'
 do
-	test_expect_success "difftool ${opt} ignores exit code" "
+	test_expect_success "difftool ${opt:-without options} ignores exit code" "
 		test_config difftool.error.cmd false &&
 		git difftool ${opt} -y -t error branch
 	"
 
-	test_expect_success "difftool ${opt} forwards exit code with --trust-exit-code" "
+	test_expect_success "difftool ${opt:-without options} forwards exit code with --trust-exit-code" "
 		test_config difftool.error.cmd false &&
 		test_must_fail git difftool ${opt} -y --trust-exit-code -t error branch
 	"
 
-	test_expect_success "difftool ${opt} forwards exit code with --trust-exit-code for built-ins" "
+	test_expect_success "difftool ${opt:-without options} forwards exit code with --trust-exit-code for built-ins" "
 		test_config difftool.vimdiff.path false &&
 		test_must_fail git difftool ${opt} -y --trust-exit-code -t vimdiff branch
 	"
 
-	test_expect_success "difftool ${opt} honors difftool.trustExitCode = true" "
+	test_expect_success "difftool ${opt:-without options} honors difftool.trustExitCode = true" "
 		test_config difftool.error.cmd false &&
 		test_config difftool.trustExitCode true &&
 		test_must_fail git difftool ${opt} -y -t error branch
 	"
 
-	test_expect_success "difftool ${opt} honors difftool.trustExitCode = false" "
+	test_expect_success "difftool ${opt:-without options} honors difftool.trustExitCode = false" "
 		test_config difftool.error.cmd false &&
 		test_config difftool.trustExitCode false &&
 		git difftool ${opt} -y -t error branch
 	"
 
-	test_expect_success "difftool ${opt} ignores exit code with --no-trust-exit-code" "
+	test_expect_success "difftool ${opt:-without options} ignores exit code with --no-trust-exit-code" "
 		test_config difftool.error.cmd false &&
 		test_config difftool.trustExitCode true &&
 		git difftool ${opt} -y --no-trust-exit-code -t error branch
 	"
 
-	test_expect_success "difftool ${opt} stops on error with --trust-exit-code" "
+	test_expect_success "difftool ${opt:-without options} stops on error with --trust-exit-code" "
 		test_when_finished 'rm -f for-diff .git/fail-right-file' &&
 		test_when_finished 'git reset -- for-diff' &&
 		write_script .git/fail-right-file <<-\EOF &&
@@ -140,7 +140,7 @@ do
 		test_line_count = 1 actual
 	"
 
-	test_expect_success "difftool ${opt} honors exit status if command not found" "
+	test_expect_success "difftool ${opt:-without options} honors exit status if command not found" "
 		test_config difftool.nonexistent.cmd i-dont-exist &&
 		test_config difftool.trustExitCode false &&
 		if test "${opt}" = '--dir-diff'
-- 
2.44.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-03-21 13:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 13:47 [PATCH 0/3] t7800: fix quoting of looped test bodies Patrick Steinhardt
2024-03-21 13:47 ` Patrick Steinhardt [this message]
2024-03-21 13:47 ` [PATCH 2/3] t7800: use single quotes for " Patrick Steinhardt
2024-03-21 13:47 ` [PATCH 3/3] t/README: document how to loop around test cases Patrick Steinhardt
2024-03-21 17:12   ` Junio C Hamano
2024-03-22  2:05     ` Patrick Steinhardt
2024-03-22  2:12       ` Junio C Hamano
2024-03-21 13:48 ` [PATCH 0/3] t7800: fix quoting of looped test bodies Patrick Steinhardt
2024-03-22  2:23 ` [PATCH v2 " Patrick Steinhardt
2024-03-22  2:23   ` [PATCH v2 1/3] t7800: improve test descriptions with empty arguments Patrick Steinhardt
2024-03-22  2:23   ` [PATCH v2 2/3] t7800: use single quotes for test bodies Patrick Steinhardt
2024-03-22  2:23   ` [PATCH v2 3/3] t/README: document how to loop around test cases Patrick Steinhardt
2024-03-22 14:37   ` [PATCH v2 0/3] t7800: fix quoting of looped test bodies Junio C Hamano

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=fd37c2931904bc64fb6ea14331aea60278f495eb.1711028473.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder.dev@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.