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>

Charvi Mendiratta committed Oct 20, 2020 at 17:13 UTC e166fe363da86e0c471617703b02021c43dca8f4
3 files changed +56 -65
t/t7101-reset-empty-subdirs.sh
+33 -33
@@ -6,16 +6,15 @@
6 test_description='git reset should cull empty subdirs'
7 . ./test-lib.sh
8
9 -test_expect_success \
10 - 'creating initial files' \
11 - 'mkdir path0 &&
9 +test_expect_success 'creating initial files' '
10 + mkdir path0 &&
11 cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
12 git add path0/COPYING &&
14 - git commit -m add -a'
13 + git commit -m add -a
14 +'
15
16 -test_expect_success \
17 - 'creating second files' \
18 - 'mkdir path1 &&
16 +test_expect_success 'creating second files' '
17 + mkdir path1 &&
18 mkdir path1/path2 &&
19 cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
20 cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
@@ -25,39 +24,40 @@ test_expect_success \
24 git add path1/COPYING &&
25 git add COPYING &&
26 git add path0/COPYING-TOO &&
28 - git commit -m change -a'
27 + git commit -m change -a
28 +'
29
30 -test_expect_success \
31 - 'resetting tree HEAD^' \
32 - 'git reset --hard HEAD^'
30 +test_expect_success 'resetting tree HEAD^' '
31 + git reset --hard HEAD^
32 +'
33
34 -test_expect_success \
35 - 'checking initial files exist after rewind' \
36 - 'test -d path0 &&
37 - test -f path0/COPYING'
34 +test_expect_success 'checking initial files exist after rewind' '
35 + test -d path0 &&
36 + test -f path0/COPYING
37 +'
38
39 -test_expect_success \
40 - 'checking lack of path1/path2/COPYING' \
41 - '! test -f path1/path2/COPYING'
39 +test_expect_success 'checking lack of path1/path2/COPYING' '
40 + ! test -f path1/path2/COPYING
41 +'
42
43 -test_expect_success \
44 - 'checking lack of path1/COPYING' \
45 - '! test -f path1/COPYING'
43 +test_expect_success 'checking lack of path1/COPYING' '
44 + ! test -f path1/COPYING
45 +'
46
47 -test_expect_success \
48 - 'checking lack of COPYING' \
49 - '! test -f COPYING'
47 +test_expect_success 'checking lack of COPYING' '
48 + ! test -f COPYING
49 +'
50
51 -test_expect_success \
52 - 'checking checking lack of path1/COPYING-TOO' \
53 - '! test -f path0/COPYING-TOO'
51 +test_expect_success 'checking checking lack of path1/COPYING-TOO' '
52 + ! test -f path0/COPYING-TOO
53 +'
54
55 -test_expect_success \
56 - 'checking lack of path1/path2' \
57 - '! test -d path1/path2'
55 +test_expect_success 'checking lack of path1/path2' '
56 + ! test -d path1/path2
57 +'
58
59 -test_expect_success \
60 - 'checking lack of path1' \
61 - '! test -d path1'
59 +test_expect_success 'checking lack of path1' '
60 + ! test -d path1
61 +'
62
63 test_done
t/t7102-reset.sh
+8 -16
@@ -107,8 +107,7 @@ test_expect_success 'reset --soft with unmerged index should fail' '
107 git rm --cached -- un
108 '
109
110 -test_expect_success \
111 - 'giving paths with options different than --mixed should fail' '
110 +test_expect_success 'giving paths with options different than --mixed should fail' '
111 test_must_fail git reset --soft -- first &&
112 test_must_fail git reset --hard -- first &&
113 test_must_fail git reset --soft HEAD^ -- first &&
@@ -128,8 +127,7 @@ test_expect_success 'giving unrecognized options should fail' '
127 check_changes $head5
128 '
129
131 -test_expect_success \
132 - 'trying to do reset --soft with pending merge should fail' '
130 +test_expect_success 'trying to do reset --soft with pending merge should fail' '
131 git branch branch1 &&
132 git branch branch2 &&
133
@@ -152,8 +150,7 @@ test_expect_success \
150 check_changes $head5
151 '
152
155 -test_expect_success \
156 - 'trying to do reset --soft with pending checkout merge should fail' '
153 +test_expect_success 'trying to do reset --soft with pending checkout merge should fail' '
154 git branch branch3 &&
155 git branch branch4 &&
156
@@ -175,8 +172,7 @@ test_expect_success \
172 check_changes $head5
173 '
174
178 -test_expect_success \
179 - 'resetting to HEAD with no changes should succeed and do nothing' '
175 +test_expect_success 'resetting to HEAD with no changes should succeed and do nothing' '
176 git reset --hard &&
177 check_changes $head5 &&
178 git reset --hard HEAD &&
@@ -226,8 +222,7 @@ secondfile:
222 2nd line 2nd file
223 3rd line 2nd file
224 EOF
229 -test_expect_success \
230 - 'changing files and redo the last commit should succeed' '
225 +test_expect_success 'changing files and redo the last commit should succeed' '
226 echo "3rd line 2nd file" >>secondfile &&
227 git commit -a -C ORIG_HEAD &&
228 head4=$(git rev-parse --verify HEAD) &&
@@ -245,8 +240,7 @@ first:
240 second:
241 2nd file
242 EOF
248 -test_expect_success \
249 - '--hard reset should change the files and undo commits permanently' '
243 +test_expect_success '--hard reset should change the files and undo commits permanently' '
244 git reset --hard HEAD~2 &&
245 check_changes $head5p2 &&
246 test "$(git rev-parse ORIG_HEAD)" = \
@@ -284,8 +278,7 @@ secondfile:
278 1st line 2nd file
279 2nd line 2nd file
280 EOF
287 -test_expect_success \
288 - 'redoing changes adding them without commit them should succeed' '
281 +test_expect_success 'redoing changes adding them without commit them should succeed' '
282 git rm first &&
283 git mv second secondfile &&
284
@@ -380,8 +373,7 @@ secondfile:
373 1st line 2nd file
374 2nd line 2nd file
375 EOF
383 -test_expect_success \
384 - '--hard reset to ORIG_HEAD should clear a fast-forward merge' '
376 +test_expect_success '--hard reset to ORIG_HEAD should clear a fast-forward merge' '
377 git reset --hard HEAD^ &&
378 check_changes $head5 &&
379
t/t7201-co.sh
+15 -16
@@ -62,7 +62,7 @@ test_expect_success setup '
62 git checkout master
63 '
64
65 -test_expect_success "checkout from non-existing branch" '
65 +test_expect_success 'checkout from non-existing branch' '
66
67 git checkout -b delete-me master &&
68 git update-ref -d --no-deref refs/heads/delete-me &&
@@ -71,7 +71,7 @@ test_expect_success "checkout from non-existing branch" '
71 test refs/heads/master = "$(git symbolic-ref HEAD)"
72 '
73
74 -test_expect_success "checkout with dirty tree without -m" '
74 +test_expect_success 'checkout with dirty tree without -m' '
75
76 fill 0 1 2 3 4 5 6 7 8 >one &&
77 if git checkout side
@@ -84,7 +84,7 @@ test_expect_success "checkout with dirty tree without -m" '
84
85 '
86
87 -test_expect_success "checkout with unrelated dirty tree without -m" '
87 +test_expect_success 'checkout with unrelated dirty tree without -m' '
88
89 git checkout -f master &&
90 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" '
95 test_cmp messages.expect messages
96 '
97
98 -test_expect_success "checkout -m with dirty tree" '
98 +test_expect_success 'checkout -m with dirty tree' '
99
100 git checkout -f master &&
101 git clean -f &&
@@ -120,7 +120,7 @@ test_expect_success "checkout -m with dirty tree" '
120 test_must_be_empty current.index
121 '
122
123 -test_expect_success "checkout -m with dirty tree, renamed" '
123 +test_expect_success 'checkout -m with dirty tree, renamed' '
124
125 git checkout -f master && git clean -f &&
126
@@ -388,22 +388,22 @@ test_expect_success 'checkout specific path while in subdirectory' '
388
389 '
390
391 -test_expect_success \
392 - 'checkout w/--track sets up tracking' '
391 +test_expect_success 'checkout w/--track sets up tracking' '
392 git config branch.autosetupmerge false &&
393 git checkout master &&
394 git checkout --track -b track1 &&
395 test "$(git config branch.track1.remote)" &&
397 - test "$(git config branch.track1.merge)"'
396 + test "$(git config branch.track1.merge)"
397 +'
398
399 -test_expect_success \
400 - 'checkout w/autosetupmerge=always sets up tracking' '
399 +test_expect_success 'checkout w/autosetupmerge=always sets up tracking' '
400 test_when_finished git config branch.autosetupmerge false &&
401 git config branch.autosetupmerge always &&
402 git checkout master &&
403 git checkout -b track2 &&
404 test "$(git config branch.track2.remote)" &&
406 - test "$(git config branch.track2.merge)"'
405 + test "$(git config branch.track2.merge)"
406 +'
407
408 test_expect_success 'checkout w/--track from non-branch HEAD fails' '
409 git checkout master^0 &&
@@ -435,8 +435,7 @@ test_expect_success 'detach a symbolic link HEAD' '
435 test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
436 '
437
438 -test_expect_success \
439 - 'checkout with --track fakes a sensible -b <name>' '
438 +test_expect_success 'checkout with --track fakes a sensible -b <name>' '
439 git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
440 git update-ref refs/remotes/origin/koala/bear renamer &&
441
@@ -457,9 +456,9 @@ test_expect_success \
456 test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
457 '
458
460 -test_expect_success \
461 - 'checkout with --track, but without -b, fails with too short tracked name' '
462 - test_must_fail git checkout --track renamer'
459 +test_expect_success 'checkout with --track, but without -b, fails with too short tracked name' '
460 + test_must_fail git checkout --track renamer
461 +'
462
463 setup_conflicting_index () {
464 rm -f .git/index &&