In the test scripts, the recommended style is, e.g.:
test_expect_success 'name' '
do-something somehow &&
do-some-more testing
'
When using this style, any single quote in the multi-line test section
is actually closing the lone single quotes that surround it.
It can be a non-issue in practice:
test_expect_success 'sed a little' '
sed -e 's/hi/lo/' in >out # "ok": no whitespace in s/hi/lo/
'
Or it can be a bug in the test, e.g., because variable interpolation
happens before the test even begins executing:
v=abc
test_expect_success 'variable interpolation' '
v=def &&
echo '"$v"' # abc
'
Change several such in-test single quotes to use double quotes instead
or, in a few cases, drop them altogether. These were identified using
some crude grepping. We're not fixing any test bugs here, but we're
hopefully making these tests slightly easier to grok and to maintain.
There are legitimate use cases for closing a quote and opening a new
one, e.g., both '\'' and '"'"' can be used to produce a literal single
quote. I'm not touching any of those here.
In t9401, tuck the redirecting ">" to the filename while we're touching
those lines.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Ågren committedAug 6, 2020 at 22:08 UTCc76b84a12160476fa795831ef3c2236e68c24f36
index 7456c567cd..6a6a760f5f 100755--- a/t/t5510-fetch.sh+++ b/t/t5510-fetch.sh@@ -213,7 +213,7 @@ test_expect_success 'fetch tags when there is no tags' ' test_expect_success 'fetch following tags' ' cd "$D" &&- git tag -a -m 'annotated' anno HEAD &&+ git tag -a -m "annotated" anno HEAD && git tag light HEAD && mkdir four &&@@ -331,7 +331,7 @@ test_expect_success 'bundle does not prerequisite objects' ' test_expect_success 'bundle should be able to create a full history' ' cd "$D" &&- git tag -a -m '1.0' v1.0 master &&+ git tag -a -m "1.0" v1.0 master && git bundle create bundle4 v1.0 '
t/t5553-set-upstream.sh
+3-3
index 81975ad8f9..7622981cbf 100755--- a/t/t5553-set-upstream.sh+++ b/t/t5553-set-upstream.sh@@ -81,7 +81,7 @@ test_expect_success 'fetch --set-upstream http://nosuchdomain.example.com fails test_expect_success 'fetch --set-upstream with valid URL sets upstream to URL' ' clear_config other other2 &&- url="file://'"$PWD"'" &&+ url="file://$PWD" && git fetch --set-upstream "$url" && check_config master "$url" HEAD && check_config_missing other &&@@ -158,7 +158,7 @@ test_expect_success 'pull --set-upstream upstream with more than one branch does test_expect_success 'pull --set-upstream with valid URL sets upstream to URL' ' clear_config master other other2 && git checkout master &&- url="file://'"$PWD"'" &&+ url="file://$PWD" && git pull --set-upstream "$url" && check_config master "$url" HEAD && check_config_missing other &&@@ -168,7 +168,7 @@ test_expect_success 'pull --set-upstream with valid URL sets upstream to URL' ' test_expect_success 'pull --set-upstream with valid URL and branch sets branch' ' clear_config master other other2 && git checkout master &&- url="file://'"$PWD"'" &&+ url="file://$PWD" && git pull --set-upstream "$url" master && check_config master "$url" refs/heads/master && check_config_missing other &&
index c978b6dee4..63d5f41a12 100755--- a/t/t7001-mv.sh+++ b/t/t7001-mv.sh@@ -177,7 +177,7 @@ test_expect_success "Sergey Vlasov's test case" ' date >ab.c && date >ab/d && git add ab.c ab &&- git commit -m 'initial' &&+ git commit -m "initial" && git mv ab a '
t/t7600-merge.sh
+3-3
index 5883a6adc3..1c85f75555 100755--- a/t/t7600-merge.sh+++ b/t/t7600-merge.sh@@ -246,7 +246,7 @@ test_expect_success 'merge --squash c3 with c7' ' # file EOF git cat-file commit HEAD >raw &&- sed -e '1,/^$/d' raw >actual &&+ sed -e "1,/^$/d" raw >actual && test_cmp expect actual '@@ -268,7 +268,7 @@ test_expect_success 'merge c3 with c7 with commit.cleanup = scissors' ' # file EOF git cat-file commit HEAD >raw &&- sed -e '1,/^$/d' raw >actual &&+ sed -e "1,/^$/d" raw >actual && test_i18ncmp expect actual '@@ -292,7 +292,7 @@ test_expect_success 'merge c3 with c7 with --squash commit.cleanup = scissors' ' # file EOF git cat-file commit HEAD >raw &&- sed -e '1,/^$/d' raw >actual &&+ sed -e "1,/^$/d" raw >actual && test_i18ncmp expect actual '
t/t9001-send-email.sh
+5-5
index ec261085ec..3d68570450 100755--- a/t/t9001-send-email.sh+++ b/t/t9001-send-email.sh@@ -1551,7 +1551,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printab --smtp-server="$(pwd)/fake.sendmail" \ email-using-8bit \ 2>errors >out &&- sed '1,/^$/d' msgtxt1 >actual &&+ sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual '@@ -1568,7 +1568,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-8bit \ 2>errors >out &&- sed '1,/^$/d' msgtxt1 >actual &&+ sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual '@@ -1594,7 +1594,7 @@ test_expect_success $PREREQ 'convert from quoted-printable to base64' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-qp \ 2>errors >out &&- sed '1,/^$/d' msgtxt1 >actual &&+ sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual '@@ -1624,7 +1624,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printabl --smtp-server="$(pwd)/fake.sendmail" \ email-using-crlf \ 2>errors >out &&- sed '1,/^$/d' msgtxt1 >actual &&+ sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual '@@ -1641,7 +1641,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-crlf \ 2>errors >out &&- sed '1,/^$/d' msgtxt1 >actual &&+ sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual '