mirror of
https://github.com/git/git
synced 2024-10-30 14:03:28 +00:00
t1400: add some more tests involving quoted arguments
Previously there were no good tests of C-quoted arguments. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
697a41519b
commit
20fcffcc8d
1 changed files with 25 additions and 1 deletions
|
@ -350,12 +350,18 @@ test_expect_success 'stdin fails on unknown command' '
|
|||
grep "fatal: unknown command: unknown $a" err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin fails on badly quoted input' '
|
||||
test_expect_success 'stdin fails on unbalanced quotes' '
|
||||
echo "create $a \"master" >stdin &&
|
||||
test_must_fail git update-ref --stdin <stdin 2>err &&
|
||||
grep "fatal: badly quoted argument: \\\"master" err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin fails on invalid escape' '
|
||||
echo "create $a \"ma\zter\"" >stdin &&
|
||||
test_must_fail git update-ref --stdin <stdin 2>err &&
|
||||
grep "fatal: badly quoted argument: \\\"ma\\\\zter\\\"" err
|
||||
'
|
||||
|
||||
test_expect_success 'stdin fails on junk after quoted argument' '
|
||||
echo "create \"$a\"master" >stdin &&
|
||||
test_must_fail git update-ref --stdin <stdin 2>err &&
|
||||
|
@ -458,6 +464,24 @@ test_expect_success 'stdin create ref works' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'stdin succeeds with quoted argument' '
|
||||
git update-ref -d $a &&
|
||||
echo "create $a \"$m\"" >stdin &&
|
||||
git update-ref --stdin <stdin &&
|
||||
git rev-parse $m >expect &&
|
||||
git rev-parse $a >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'stdin succeeds with escaped character' '
|
||||
git update-ref -d $a &&
|
||||
echo "create $a \"ma\\163ter\"" >stdin &&
|
||||
git update-ref --stdin <stdin &&
|
||||
git rev-parse $m >expect &&
|
||||
git rev-parse $a >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'stdin update ref creates with zero old value' '
|
||||
echo "update $b $m $Z" >stdin &&
|
||||
git update-ref --stdin <stdin &&
|
||||
|
|
Loading…
Reference in a new issue