Skip to content

Commit b821ca7

Browse files
newrengitster
authored andcommitted
t6020, t6022, t6035: update merge tests to use test helper functions
Make use of test_path_is_file, test_write_lines, and similar helpers in these old test files. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42d180d commit b821ca7

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

t/t6020-merge-df.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ test_expect_success 'modify/delete + directory/file conflict' '
8383
test 4 -eq $(git ls-files -u | wc -l) &&
8484
test 1 -eq $(git ls-files -o | wc -l) &&
8585
86-
test -f letters/file &&
87-
test -f letters.txt &&
88-
test -f letters~modify
86+
test_path_is_file letters/file &&
87+
test_path_is_file letters.txt &&
88+
test_path_is_file letters~modify
8989
'
9090

9191
test_expect_success 'modify/delete + directory/file conflict; other way' '
@@ -99,9 +99,9 @@ test_expect_success 'modify/delete + directory/file conflict; other way' '
9999
test 4 -eq $(git ls-files -u | wc -l) &&
100100
test 1 -eq $(git ls-files -o | wc -l) &&
101101
102-
test -f letters/file &&
103-
test -f letters.txt &&
104-
test -f letters~HEAD
102+
test_path_is_file letters/file &&
103+
test_path_is_file letters.txt &&
104+
test_path_is_file letters~HEAD
105105
'
106106

107107
test_done

t/t6022-merge-rename.sh

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way'
295295
git merge --strategy=recursive dir-not-in-way &&
296296
297297
git diff --quiet &&
298-
test -f dir &&
299-
printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected &&
298+
test_path_is_file dir &&
299+
test_write_lines 1 2 3 4 5555 6 7 8 9 10 11 >expected &&
300300
test_cmp expected dir
301301
'
302302

@@ -316,8 +316,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
316316
test_must_fail git diff --quiet &&
317317
test_must_fail git diff --cached --quiet &&
318318
319-
test -f dir/file-in-the-way &&
320-
test -f dir~HEAD &&
319+
test_path_is_file dir/file-in-the-way &&
320+
test_path_is_file dir~HEAD &&
321321
test_cmp expected dir~HEAD
322322
'
323323

@@ -338,8 +338,8 @@ test_expect_success 'Same as previous, but merged other way' '
338338
test_must_fail git diff --quiet &&
339339
test_must_fail git diff --cached --quiet &&
340340
341-
test -f dir/file-in-the-way &&
342-
test -f dir~renamed-file-has-no-conflicts &&
341+
test_path_is_file dir/file-in-the-way &&
342+
test_path_is_file dir~renamed-file-has-no-conflicts &&
343343
test_cmp expected dir~renamed-file-has-no-conflicts
344344
'
345345

@@ -355,7 +355,7 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in
355355
test_must_fail git diff --quiet &&
356356
test_must_fail git diff --cached --quiet &&
357357
358-
test -f dir &&
358+
test_path_is_file dir &&
359359
cat >expected <<-\EOF &&
360360
1
361361
2
@@ -391,8 +391,8 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
391391
test_must_fail git diff --quiet &&
392392
test_must_fail git diff --cached --quiet &&
393393
394-
test -f dir/file-in-the-way &&
395-
test -f dir~HEAD &&
394+
test_path_is_file dir/file-in-the-way &&
395+
test_path_is_file dir~HEAD &&
396396
test_cmp expected dir~HEAD
397397
'
398398

@@ -409,8 +409,8 @@ test_expect_success 'Same as previous, but merged other way' '
409409
test_must_fail git diff --quiet &&
410410
test_must_fail git diff --cached --quiet &&
411411
412-
test -f dir/file-in-the-way &&
413-
test -f dir~renamed-file-has-conflicts &&
412+
test_path_is_file dir/file-in-the-way &&
413+
test_path_is_file dir~renamed-file-has-conflicts &&
414414
cat >expected <<-\EOF &&
415415
1
416416
2
@@ -463,9 +463,9 @@ test_expect_success 'both rename source and destination involved in D/F conflict
463463
464464
test_must_fail git diff --quiet &&
465465
466-
test -f destdir/foo &&
467-
test -f one &&
468-
test -f destdir~HEAD &&
466+
test_path_is_file destdir/foo &&
467+
test_path_is_file one &&
468+
test_path_is_file destdir~HEAD &&
469469
test "stuff" = "$(cat destdir~HEAD)"
470470
'
471471

@@ -506,9 +506,9 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked
506506
507507
test 4 -eq $(find . | grep -v .git | wc -l) &&
508508
509-
test -d one &&
510-
test -f one~rename-two &&
511-
test -f two &&
509+
test_path_is_dir one &&
510+
test_path_is_file one~rename-two &&
511+
test_path_is_file two &&
512512
test "other" = $(cat one~rename-two) &&
513513
test "stuff" = $(cat two)
514514
'
@@ -526,8 +526,8 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean sta
526526
527527
test 3 -eq $(find . | grep -v .git | wc -l) &&
528528
529-
test -f one &&
530-
test -f two &&
529+
test_path_is_file one &&
530+
test_path_is_file two &&
531531
test "other" = $(cat one) &&
532532
test "stuff" = $(cat two)
533533
'
@@ -567,11 +567,11 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
567567
test 1 -eq "$(git ls-files -u original | wc -l)" &&
568568
test 2 -eq "$(git ls-files -o | wc -l)" &&
569569
570-
test -f one/file &&
571-
test -f two/file &&
572-
test -f one~HEAD &&
573-
test -f two~second-rename &&
574-
! test -f original
570+
test_path_is_file one/file &&
571+
test_path_is_file two/file &&
572+
test_path_is_file one~HEAD &&
573+
test_path_is_file two~second-rename &&
574+
test_path_is_missing original
575575
'
576576

577577
test_expect_success 'setup rename one file to two; directories moving out of the way' '
@@ -606,9 +606,9 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
606606
test 1 -eq "$(git ls-files -u original | wc -l)" &&
607607
test 0 -eq "$(git ls-files -o | wc -l)" &&
608608
609-
test -f one &&
610-
test -f two &&
611-
! test -f original
609+
test_path_is_file one &&
610+
test_path_is_file two &&
611+
test_path_is_missing original
612612
'
613613

614614
test_expect_success 'setup avoid unnecessary update, normal rename' '

t/t6035-merge-dir-to-symlink.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ test_expect_success 'a/b-2/c/d is kept when clobbering symlink b' '
3131
git rm --cached a/b &&
3232
git commit -m "untracked symlink remains" &&
3333
git checkout -f start^0 &&
34-
test -f a/b-2/c/d
34+
test_path_is_file a/b-2/c/d
3535
'
3636

3737
test_expect_success 'checkout should not have deleted a/b-2/c/d' '
3838
git checkout HEAD^0 &&
3939
git reset --hard master &&
4040
git checkout start^0 &&
41-
test -f a/b-2/c/d
41+
test_path_is_file a/b-2/c/d
4242
'
4343

4444
test_expect_success 'setup for merge test' '
4545
git reset --hard &&
46-
test -f a/b-2/c/d &&
46+
test_path_is_file a/b-2/c/d &&
4747
echo x > a/x &&
4848
git add a/x &&
4949
git commit -m x &&
@@ -54,7 +54,7 @@ test_expect_success 'Handle D/F conflict, do not lose a/b-2/c/d in merge (resolv
5454
git reset --hard &&
5555
git checkout baseline^0 &&
5656
git merge -s resolve master &&
57-
test -f a/b-2/c/d
57+
test_path_is_file a/b-2/c/d
5858
'
5959

6060
test_expect_success SYMLINKS 'a/b was resolved as symlink' '
@@ -65,7 +65,7 @@ test_expect_success 'Handle D/F conflict, do not lose a/b-2/c/d in merge (recurs
6565
git reset --hard &&
6666
git checkout baseline^0 &&
6767
git merge -s recursive master &&
68-
test -f a/b-2/c/d
68+
test_path_is_file a/b-2/c/d
6969
'
7070

7171
test_expect_success SYMLINKS 'a/b was resolved as symlink' '
@@ -76,7 +76,7 @@ test_expect_success 'Handle F/D conflict, do not lose a/b-2/c/d in merge (resolv
7676
git reset --hard &&
7777
git checkout master^0 &&
7878
git merge -s resolve baseline^0 &&
79-
test -f a/b-2/c/d
79+
test_path_is_file a/b-2/c/d
8080
'
8181

8282
test_expect_success SYMLINKS 'a/b was resolved as symlink' '
@@ -87,7 +87,7 @@ test_expect_success 'Handle F/D conflict, do not lose a/b-2/c/d in merge (recurs
8787
git reset --hard &&
8888
git checkout master^0 &&
8989
git merge -s recursive baseline^0 &&
90-
test -f a/b-2/c/d
90+
test_path_is_file a/b-2/c/d
9191
'
9292

9393
test_expect_success SYMLINKS 'a/b was resolved as symlink' '
@@ -99,17 +99,17 @@ test_expect_failure 'do not lose untracked in merge (resolve)' '
9999
git checkout baseline^0 &&
100100
>a/b/c/e &&
101101
test_must_fail git merge -s resolve master &&
102-
test -f a/b/c/e &&
103-
test -f a/b-2/c/d
102+
test_path_is_file a/b/c/e &&
103+
test_path_is_file a/b-2/c/d
104104
'
105105

106106
test_expect_success 'do not lose untracked in merge (recursive)' '
107107
git reset --hard &&
108108
git checkout baseline^0 &&
109109
>a/b/c/e &&
110110
test_must_fail git merge -s recursive master &&
111-
test -f a/b/c/e &&
112-
test -f a/b-2/c/d
111+
test_path_is_file a/b/c/e &&
112+
test_path_is_file a/b-2/c/d
113113
'
114114

115115
test_expect_success 'do not lose modifications in merge (resolve)' '
@@ -140,7 +140,7 @@ test_expect_success 'merge should not have D/F conflicts (resolve)' '
140140
git reset --hard &&
141141
git checkout baseline^0 &&
142142
git merge -s resolve test2 &&
143-
test -f a/b/c/d
143+
test_path_is_file a/b/c/d
144144
'
145145

146146
test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' '
@@ -151,7 +151,7 @@ test_expect_success 'merge should not have D/F conflicts (recursive)' '
151151
git reset --hard &&
152152
git checkout baseline^0 &&
153153
git merge -s recursive test2 &&
154-
test -f a/b/c/d
154+
test_path_is_file a/b/c/d
155155
'
156156

157157
test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' '
@@ -162,7 +162,7 @@ test_expect_success 'merge should not have F/D conflicts (recursive)' '
162162
git reset --hard &&
163163
git checkout -b foo test2 &&
164164
git merge -s recursive baseline^0 &&
165-
test -f a/b/c/d
165+
test_path_is_file a/b/c/d
166166
'
167167

168168
test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' '

0 commit comments

Comments
 (0)