diff options
author | Martin Ågren <martin.agren@gmail.com> | 2020-08-06 22:08:53 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-06 15:14:32 -0700 |
commit | c76b84a12160476fa795831ef3c2236e68c24f36 (patch) | |
tree | 62f0c818bfd20543e58f66beb67288a36d890668 /t/t4150-am.sh | |
parent | Fourth batch (diff) | |
download | tgif-c76b84a12160476fa795831ef3c2236e68c24f36.tar.xz |
t: don't spuriously close and reopen quotes
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>
Diffstat (limited to 't/t4150-am.sh')
-rwxr-xr-x | t/t4150-am.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh index bda4586a79..855ed11b32 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -989,7 +989,7 @@ test_expect_success 'am -s unexpected trailer block' ' Signed-off-by: J C H <j@c.h> EOF git commit -F msg && - git cat-file commit HEAD | sed -e '1,/^$/d' >original && + git cat-file commit HEAD | sed -e "1,/^$/d" >original && git format-patch --stdout -1 >patch && git reset --hard HEAD^ && @@ -998,7 +998,7 @@ test_expect_success 'am -s unexpected trailer block' ' cat original && echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" ) >expect && - git cat-file commit HEAD | sed -e '1,/^$/d' >actual && + git cat-file commit HEAD | sed -e "1,/^$/d" >actual && test_cmp expect actual && cat >msg <<-\EOF && @@ -1009,7 +1009,7 @@ test_expect_success 'am -s unexpected trailer block' ' EOF git reset HEAD^ && git commit -F msg file && - git cat-file commit HEAD | sed -e '1,/^$/d' >original && + git cat-file commit HEAD | sed -e "1,/^$/d" >original && git format-patch --stdout -1 >patch && git reset --hard HEAD^ && @@ -1020,7 +1020,7 @@ test_expect_success 'am -s unexpected trailer block' ' echo && echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" ) >expect && - git cat-file commit HEAD | sed -e '1,/^$/d' >actual && + git cat-file commit HEAD | sed -e "1,/^$/d" >actual && test_cmp expect actual ' |