t7101,t7102,t7201: modernize test formatting

Some tests in these scripts are formatted using a very old style:
        test_expect_success \
            'title' \
            'body line 1 &&
             body line 2'

Updating the formatting to the modern style:
        test_expect_success 'title' '
            body line 1 &&
            body line 2
        '

Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Charvi Mendiratta 2020-10-20 17:13:15 +05:30 коммит произвёл Junio C Hamano
Родитель 69986e19ff
Коммит e166fe363d
3 изменённых файлов: 56 добавлений и 65 удалений

Просмотреть файл

@ -6,16 +6,15 @@
test_description='git reset should cull empty subdirs' test_description='git reset should cull empty subdirs'
. ./test-lib.sh . ./test-lib.sh
test_expect_success \ test_expect_success 'creating initial files' '
'creating initial files' \ mkdir path0 &&
'mkdir path0 &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
git add path0/COPYING && git add path0/COPYING &&
git commit -m add -a' git commit -m add -a
'
test_expect_success \ test_expect_success 'creating second files' '
'creating second files' \ mkdir path1 &&
'mkdir path1 &&
mkdir path1/path2 && mkdir path1/path2 &&
cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING && cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
cp "$TEST_DIRECTORY"/../COPYING path1/COPYING && cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
@ -25,39 +24,40 @@ test_expect_success \
git add path1/COPYING && git add path1/COPYING &&
git add COPYING && git add COPYING &&
git add path0/COPYING-TOO && git add path0/COPYING-TOO &&
git commit -m change -a' git commit -m change -a
'
test_expect_success \ test_expect_success 'resetting tree HEAD^' '
'resetting tree HEAD^' \ git reset --hard HEAD^
'git reset --hard HEAD^' '
test_expect_success \ test_expect_success 'checking initial files exist after rewind' '
'checking initial files exist after rewind' \ test -d path0 &&
'test -d path0 && test -f path0/COPYING
test -f path0/COPYING' '
test_expect_success \ test_expect_success 'checking lack of path1/path2/COPYING' '
'checking lack of path1/path2/COPYING' \ ! test -f path1/path2/COPYING
'! test -f path1/path2/COPYING' '
test_expect_success \ test_expect_success 'checking lack of path1/COPYING' '
'checking lack of path1/COPYING' \ ! test -f path1/COPYING
'! test -f path1/COPYING' '
test_expect_success \ test_expect_success 'checking lack of COPYING' '
'checking lack of COPYING' \ ! test -f COPYING
'! test -f COPYING' '
test_expect_success \ test_expect_success 'checking checking lack of path1/COPYING-TOO' '
'checking checking lack of path1/COPYING-TOO' \ ! test -f path0/COPYING-TOO
'! test -f path0/COPYING-TOO' '
test_expect_success \ test_expect_success 'checking lack of path1/path2' '
'checking lack of path1/path2' \ ! test -d path1/path2
'! test -d path1/path2' '
test_expect_success \ test_expect_success 'checking lack of path1' '
'checking lack of path1' \ ! test -d path1
'! test -d path1' '
test_done test_done

Просмотреть файл

@ -107,8 +107,7 @@ test_expect_success 'reset --soft with unmerged index should fail' '
git rm --cached -- un git rm --cached -- un
' '
test_expect_success \ test_expect_success 'giving paths with options different than --mixed should fail' '
'giving paths with options different than --mixed should fail' '
test_must_fail git reset --soft -- first && test_must_fail git reset --soft -- first &&
test_must_fail git reset --hard -- first && test_must_fail git reset --hard -- first &&
test_must_fail git reset --soft HEAD^ -- first && test_must_fail git reset --soft HEAD^ -- first &&
@ -128,8 +127,7 @@ test_expect_success 'giving unrecognized options should fail' '
check_changes $head5 check_changes $head5
' '
test_expect_success \ test_expect_success 'trying to do reset --soft with pending merge should fail' '
'trying to do reset --soft with pending merge should fail' '
git branch branch1 && git branch branch1 &&
git branch branch2 && git branch branch2 &&
@ -152,8 +150,7 @@ test_expect_success \
check_changes $head5 check_changes $head5
' '
test_expect_success \ test_expect_success 'trying to do reset --soft with pending checkout merge should fail' '
'trying to do reset --soft with pending checkout merge should fail' '
git branch branch3 && git branch branch3 &&
git branch branch4 && git branch branch4 &&
@ -175,8 +172,7 @@ test_expect_success \
check_changes $head5 check_changes $head5
' '
test_expect_success \ test_expect_success 'resetting to HEAD with no changes should succeed and do nothing' '
'resetting to HEAD with no changes should succeed and do nothing' '
git reset --hard && git reset --hard &&
check_changes $head5 && check_changes $head5 &&
git reset --hard HEAD && git reset --hard HEAD &&
@ -226,8 +222,7 @@ secondfile:
2nd line 2nd file 2nd line 2nd file
3rd line 2nd file 3rd line 2nd file
EOF EOF
test_expect_success \ test_expect_success 'changing files and redo the last commit should succeed' '
'changing files and redo the last commit should succeed' '
echo "3rd line 2nd file" >>secondfile && echo "3rd line 2nd file" >>secondfile &&
git commit -a -C ORIG_HEAD && git commit -a -C ORIG_HEAD &&
head4=$(git rev-parse --verify HEAD) && head4=$(git rev-parse --verify HEAD) &&
@ -245,8 +240,7 @@ first:
second: second:
2nd file 2nd file
EOF EOF
test_expect_success \ test_expect_success '--hard reset should change the files and undo commits permanently' '
'--hard reset should change the files and undo commits permanently' '
git reset --hard HEAD~2 && git reset --hard HEAD~2 &&
check_changes $head5p2 && check_changes $head5p2 &&
test "$(git rev-parse ORIG_HEAD)" = \ test "$(git rev-parse ORIG_HEAD)" = \
@ -284,8 +278,7 @@ secondfile:
1st line 2nd file 1st line 2nd file
2nd line 2nd file 2nd line 2nd file
EOF EOF
test_expect_success \ test_expect_success 'redoing changes adding them without commit them should succeed' '
'redoing changes adding them without commit them should succeed' '
git rm first && git rm first &&
git mv second secondfile && git mv second secondfile &&
@ -380,8 +373,7 @@ secondfile:
1st line 2nd file 1st line 2nd file
2nd line 2nd file 2nd line 2nd file
EOF EOF
test_expect_success \ test_expect_success '--hard reset to ORIG_HEAD should clear a fast-forward merge' '
'--hard reset to ORIG_HEAD should clear a fast-forward merge' '
git reset --hard HEAD^ && git reset --hard HEAD^ &&
check_changes $head5 && check_changes $head5 &&

Просмотреть файл

@ -62,7 +62,7 @@ test_expect_success setup '
git checkout master git checkout master
' '
test_expect_success "checkout from non-existing branch" ' test_expect_success 'checkout from non-existing branch' '
git checkout -b delete-me master && git checkout -b delete-me master &&
git update-ref -d --no-deref refs/heads/delete-me && git update-ref -d --no-deref refs/heads/delete-me &&
@ -71,7 +71,7 @@ test_expect_success "checkout from non-existing branch" '
test refs/heads/master = "$(git symbolic-ref HEAD)" test refs/heads/master = "$(git symbolic-ref HEAD)"
' '
test_expect_success "checkout with dirty tree without -m" ' test_expect_success 'checkout with dirty tree without -m' '
fill 0 1 2 3 4 5 6 7 8 >one && fill 0 1 2 3 4 5 6 7 8 >one &&
if git checkout side if git checkout side
@ -84,7 +84,7 @@ test_expect_success "checkout with dirty tree without -m" '
' '
test_expect_success "checkout with unrelated dirty tree without -m" ' test_expect_success 'checkout with unrelated dirty tree without -m' '
git checkout -f master && git checkout -f master &&
fill 0 1 2 3 4 5 6 7 8 >same && fill 0 1 2 3 4 5 6 7 8 >same &&
@ -95,7 +95,7 @@ test_expect_success "checkout with unrelated dirty tree without -m" '
test_cmp messages.expect messages test_cmp messages.expect messages
' '
test_expect_success "checkout -m with dirty tree" ' test_expect_success 'checkout -m with dirty tree' '
git checkout -f master && git checkout -f master &&
git clean -f && git clean -f &&
@ -120,7 +120,7 @@ test_expect_success "checkout -m with dirty tree" '
test_must_be_empty current.index test_must_be_empty current.index
' '
test_expect_success "checkout -m with dirty tree, renamed" ' test_expect_success 'checkout -m with dirty tree, renamed' '
git checkout -f master && git clean -f && git checkout -f master && git clean -f &&
@ -388,22 +388,22 @@ test_expect_success 'checkout specific path while in subdirectory' '
' '
test_expect_success \ test_expect_success 'checkout w/--track sets up tracking' '
'checkout w/--track sets up tracking' '
git config branch.autosetupmerge false && git config branch.autosetupmerge false &&
git checkout master && git checkout master &&
git checkout --track -b track1 && git checkout --track -b track1 &&
test "$(git config branch.track1.remote)" && test "$(git config branch.track1.remote)" &&
test "$(git config branch.track1.merge)"' test "$(git config branch.track1.merge)"
'
test_expect_success \ test_expect_success 'checkout w/autosetupmerge=always sets up tracking' '
'checkout w/autosetupmerge=always sets up tracking' '
test_when_finished git config branch.autosetupmerge false && test_when_finished git config branch.autosetupmerge false &&
git config branch.autosetupmerge always && git config branch.autosetupmerge always &&
git checkout master && git checkout master &&
git checkout -b track2 && git checkout -b track2 &&
test "$(git config branch.track2.remote)" && test "$(git config branch.track2.remote)" &&
test "$(git config branch.track2.merge)"' test "$(git config branch.track2.merge)"
'
test_expect_success 'checkout w/--track from non-branch HEAD fails' ' test_expect_success 'checkout w/--track from non-branch HEAD fails' '
git checkout master^0 && git checkout master^0 &&
@ -435,8 +435,7 @@ test_expect_success 'detach a symbolic link HEAD' '
test "z$(git rev-parse --verify refs/heads/master)" = "z$here" test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
' '
test_expect_success \ test_expect_success 'checkout with --track fakes a sensible -b <name>' '
'checkout with --track fakes a sensible -b <name>' '
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
git update-ref refs/remotes/origin/koala/bear renamer && git update-ref refs/remotes/origin/koala/bear renamer &&
@ -457,9 +456,9 @@ test_expect_success \
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
' '
test_expect_success \ test_expect_success 'checkout with --track, but without -b, fails with too short tracked name' '
'checkout with --track, but without -b, fails with too short tracked name' ' test_must_fail git checkout --track renamer
test_must_fail git checkout --track renamer' '
setup_conflicting_index () { setup_conflicting_index () {
rm -f .git/index && rm -f .git/index &&