t: don't spuriously close and reopen quotes
authorMartin Ågren <martin.agren@gmail.com>
Thu, 6 Aug 2020 20:08:53 +0000 (22:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Aug 2020 22:14:32 +0000 (15:14 -0700)
commitc76b84a12160476fa795831ef3c2236e68c24f36
tree62f0c818bfd20543e58f66beb67288a36d890668
parentdc04167d378fb29d30e1647ff6ff51dd182bc9a3
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>
17 files changed:
t/t1400-update-ref.sh
t/t3501-revert-cherry-pick.sh
t/t3507-cherry-pick-conflict.sh
t/t4005-diff-rename-2.sh
t/t4034-diff-words.sh
t/t4150-am.sh
t/t4200-rerere.sh
t/t5302-pack-index.sh
t/t5510-fetch.sh
t/t5553-set-upstream.sh
t/t6026-merge-attr.sh
t/t7001-mv.sh
t/t7600-merge.sh
t/t9001-send-email.sh
t/t9100-git-svn-basic.sh
t/t9401-git-cvsserver-crlf.sh
t/t9402-git-cvsserver-refs.sh