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 2/3] t7800: use single quotes for test bodies
Date: Thu, 21 Mar 2024 14:47:28 +0100	[thread overview]
Message-ID: <a4ca974397aadef251c2317efa88fd9c03e8f195.1711028473.git.ps@pks.im> (raw)
In-Reply-To: <cover.1711028473.git.ps@pks.im>

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

In eb84c8b6ce (git-difftool--helper: honor `--trust-exit-code` with
`--dir-diff`, 2024-02-20) we have started to loop around some of the
tests in t7800 so that they are reexecuted with slightly different
arguments. As part of that refactoring the quoting of test bodies was
changed from single quotes (') to double quotes (") so that the value of
the loop variable is accessible to the body.

As the test body is later on passed to eval this change was not required
though. Let's revert it back to use single quotes as usual in our tests.

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

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 80bf108f54..cc917b257e 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -93,42 +93,42 @@ test_expect_success 'difftool forwards arguments to diff' '
 
 for opt in '' '--dir-diff'
 do
-	test_expect_success "difftool ${opt:-without options} 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:-without options} 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:-without options} 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:-without options} 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:-without options} 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:-without options} 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:-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' &&
+	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 &&
 		echo failed
 		exit 1
@@ -138,19 +138,19 @@ do
 		test_must_fail git difftool ${opt} -y --trust-exit-code \
 			--extcmd .git/fail-right-file branch >actual &&
 		test_line_count = 1 actual
-	"
+	'
 
-	test_expect_success "difftool ${opt:-without options} 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'
+		if test "${opt}" = --dir-diff
 		then
 			expected_code=127
 		else
 			expected_code=128
 		fi &&
-		test_expect_code \${expected_code} git difftool ${opt} -y -t nonexistent branch
-	"
+		test_expect_code ${expected_code} git difftool ${opt} -y -t nonexistent branch
+	'
 done
 
 test_expect_success 'difftool honors --gui' '
-- 
2.44.0


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

  parent 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 ` [PATCH 1/3] t7800: improve test descriptions with empty arguments Patrick Steinhardt
2024-03-21 13:47 ` Patrick Steinhardt [this message]
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=a4ca974397aadef251c2317efa88fd9c03e8f195.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.