Re: [PATCH] tests: fix syntax error in "Use advise() for hints" test
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 19, 2010, 04:30 UTC
- Message-ID
- <20100819043036.GD25649@burratino>
- In-Reply-To
- <1282142204-14720-1-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> Change the test introduced in the "Use advise() for hints" patch by > Jonathan Nieder not to use '' for quotes inside '' delimited code.
Yikes. Thanks for catching this.
> -test_expect_success 'advice from failed cherry-pick' ' > +test_expect_success 'advice from failed cherry-pick' "
[...]
> cat <<-EOF >expected && > - error: could not apply $picked... picked > + error: could not apply \$picked... picked
Although the style you chose is arguably the least ugly, nested shell interpolation can be hard to follow. How about this?
-- 8< -- Subject: t3507 (cherry-pick): escape quotes in "Use advise()" test
Do not use unescaped '' quotes inside ''-delimited code. Otherwise, this test tries to read a file named "paths" in the test repository, resulting in the error:
t3507-cherry-pick-conflict.sh: 59: cannot open paths: No such file
Based-on-patch-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- t/t3507-cherry-pick-conflict.sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index 3f29594..6026e7e 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -50,8 +50,8 @@ test_expect_success 'advice from failed cherry-pick' ' cat <<-EOF >expected && error: could not apply $picked... picked hint: after resolving the conflicts, mark the corrected paths - hint: with 'git add <paths>' or 'git rm <paths>' - hint: and commit the result with 'git commit -c $picked' + hint: with '\''git add <paths>'\'' or '\''git rm <paths>'\'' + hint: and commit the result with '\''git commit -c $picked'\'' EOF test_must_fail git cherry-pick picked 2>actual &&
-- 1.7.2.1.544.ga752d.dirty