Skip to content

Commit e166fe3

Browse files
charvi-077gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 69986e1 commit e166fe3

File tree

3 files changed

+56
-65
lines changed

3 files changed

+56
-65
lines changed

t/t7101-reset-empty-subdirs.sh

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
test_description='git reset should cull empty subdirs'
77
. ./test-lib.sh
88

9-
test_expect_success \
10-
'creating initial files' \
11-
'mkdir path0 &&
9+
test_expect_success 'creating initial files' '
10+
mkdir path0 &&
1211
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
1312
git add path0/COPYING &&
14-
git commit -m add -a'
13+
git commit -m add -a
14+
'
1515

16-
test_expect_success \
17-
'creating second files' \
18-
'mkdir path1 &&
16+
test_expect_success 'creating second files' '
17+
mkdir path1 &&
1918
mkdir path1/path2 &&
2019
cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
2120
cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
@@ -25,39 +24,40 @@ test_expect_success \
2524
git add path1/COPYING &&
2625
git add COPYING &&
2726
git add path0/COPYING-TOO &&
28-
git commit -m change -a'
27+
git commit -m change -a
28+
'
2929

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+
'
3333

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+
'
3838

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+
'
4242

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+
'
4646

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+
'
5050

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+
'
5454

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+
'
5858

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+
'
6262

6363
test_done

t/t7102-reset.sh

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ test_expect_success 'reset --soft with unmerged index should fail' '
107107
git rm --cached -- un
108108
'
109109

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' '
112111
test_must_fail git reset --soft -- first &&
113112
test_must_fail git reset --hard -- first &&
114113
test_must_fail git reset --soft HEAD^ -- first &&
@@ -128,8 +127,7 @@ test_expect_success 'giving unrecognized options should fail' '
128127
check_changes $head5
129128
'
130129

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' '
133131
git branch branch1 &&
134132
git branch branch2 &&
135133
@@ -152,8 +150,7 @@ test_expect_success \
152150
check_changes $head5
153151
'
154152

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' '
157154
git branch branch3 &&
158155
git branch branch4 &&
159156
@@ -175,8 +172,7 @@ test_expect_success \
175172
check_changes $head5
176173
'
177174

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' '
180176
git reset --hard &&
181177
check_changes $head5 &&
182178
git reset --hard HEAD &&
@@ -226,8 +222,7 @@ secondfile:
226222
2nd line 2nd file
227223
3rd line 2nd file
228224
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' '
231226
echo "3rd line 2nd file" >>secondfile &&
232227
git commit -a -C ORIG_HEAD &&
233228
head4=$(git rev-parse --verify HEAD) &&
@@ -245,8 +240,7 @@ first:
245240
second:
246241
2nd file
247242
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' '
250244
git reset --hard HEAD~2 &&
251245
check_changes $head5p2 &&
252246
test "$(git rev-parse ORIG_HEAD)" = \
@@ -284,8 +278,7 @@ secondfile:
284278
1st line 2nd file
285279
2nd line 2nd file
286280
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' '
289282
git rm first &&
290283
git mv second secondfile &&
291284
@@ -380,8 +373,7 @@ secondfile:
380373
1st line 2nd file
381374
2nd line 2nd file
382375
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' '
385377
git reset --hard HEAD^ &&
386378
check_changes $head5 &&
387379

t/t7201-co.sh

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test_expect_success setup '
6262
git checkout master
6363
'
6464

65-
test_expect_success "checkout from non-existing branch" '
65+
test_expect_success 'checkout from non-existing branch' '
6666
6767
git checkout -b delete-me master &&
6868
git update-ref -d --no-deref refs/heads/delete-me &&
@@ -71,7 +71,7 @@ test_expect_success "checkout from non-existing branch" '
7171
test refs/heads/master = "$(git symbolic-ref HEAD)"
7272
'
7373

74-
test_expect_success "checkout with dirty tree without -m" '
74+
test_expect_success 'checkout with dirty tree without -m' '
7575
7676
fill 0 1 2 3 4 5 6 7 8 >one &&
7777
if git checkout side
@@ -84,7 +84,7 @@ test_expect_success "checkout with dirty tree without -m" '
8484
8585
'
8686

87-
test_expect_success "checkout with unrelated dirty tree without -m" '
87+
test_expect_success 'checkout with unrelated dirty tree without -m' '
8888
8989
git checkout -f master &&
9090
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" '
9595
test_cmp messages.expect messages
9696
'
9797

98-
test_expect_success "checkout -m with dirty tree" '
98+
test_expect_success 'checkout -m with dirty tree' '
9999
100100
git checkout -f master &&
101101
git clean -f &&
@@ -120,7 +120,7 @@ test_expect_success "checkout -m with dirty tree" '
120120
test_must_be_empty current.index
121121
'
122122

123-
test_expect_success "checkout -m with dirty tree, renamed" '
123+
test_expect_success 'checkout -m with dirty tree, renamed' '
124124
125125
git checkout -f master && git clean -f &&
126126
@@ -388,22 +388,22 @@ test_expect_success 'checkout specific path while in subdirectory' '
388388
389389
'
390390

391-
test_expect_success \
392-
'checkout w/--track sets up tracking' '
391+
test_expect_success 'checkout w/--track sets up tracking' '
393392
git config branch.autosetupmerge false &&
394393
git checkout master &&
395394
git checkout --track -b track1 &&
396395
test "$(git config branch.track1.remote)" &&
397-
test "$(git config branch.track1.merge)"'
396+
test "$(git config branch.track1.merge)"
397+
'
398398

399-
test_expect_success \
400-
'checkout w/autosetupmerge=always sets up tracking' '
399+
test_expect_success 'checkout w/autosetupmerge=always sets up tracking' '
401400
test_when_finished git config branch.autosetupmerge false &&
402401
git config branch.autosetupmerge always &&
403402
git checkout master &&
404403
git checkout -b track2 &&
405404
test "$(git config branch.track2.remote)" &&
406-
test "$(git config branch.track2.merge)"'
405+
test "$(git config branch.track2.merge)"
406+
'
407407

408408
test_expect_success 'checkout w/--track from non-branch HEAD fails' '
409409
git checkout master^0 &&
@@ -435,8 +435,7 @@ test_expect_success 'detach a symbolic link HEAD' '
435435
test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
436436
'
437437

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>' '
440439
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
441440
git update-ref refs/remotes/origin/koala/bear renamer &&
442441
@@ -457,9 +456,9 @@ test_expect_success \
457456
test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
458457
'
459458

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+
'
463462

464463
setup_conflicting_index () {
465464
rm -f .git/index &&

0 commit comments

Comments
 (0)