Skip to content

Commit 90c0c15

Browse files
committed
Merge branch 'cp/t9146-use-test-path-helpers' into HEAD
Test script clean-up. * cp/t9146-use-test-path-helpers: t9146: replace test -d/-e/-f with appropriate test_path_is_* function
2 parents a87469c + c431a23 commit 90c0c15

File tree

1 file changed

+12
-44
lines changed

1 file changed

+12
-44
lines changed

t/t9146-git-svn-empty-dirs.sh

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ test_expect_success 'empty directories exist' '
2020
cd cloned &&
2121
for i in a b c d d/e d/e/f "weird file name"
2222
do
23-
if ! test -d "$i"
24-
then
25-
echo >&2 "$i does not exist" &&
26-
exit 1
27-
fi
23+
test_path_is_dir "$i" || exit 1
2824
done
2925
)
3026
'
@@ -37,11 +33,7 @@ test_expect_success 'option automkdirs set to false' '
3733
git svn fetch &&
3834
for i in a b c d d/e d/e/f "weird file name"
3935
do
40-
if test -d "$i"
41-
then
42-
echo >&2 "$i exists" &&
43-
exit 1
44-
fi
36+
test_path_is_missing "$i" || exit 1
4537
done
4638
)
4739
'
@@ -52,7 +44,7 @@ test_expect_success 'more emptiness' '
5244

5345
test_expect_success 'git svn rebase creates empty directory' '
5446
( cd cloned && git svn rebase ) &&
55-
test -d cloned/"! !"
47+
test_path_is_dir cloned/"! !"
5648
'
5749

5850
test_expect_success 'git svn mkdirs recreates empty directories' '
@@ -62,11 +54,7 @@ test_expect_success 'git svn mkdirs recreates empty directories' '
6254
git svn mkdirs &&
6355
for i in a b c d d/e d/e/f "weird file name" "! !"
6456
do
65-
if ! test -d "$i"
66-
then
67-
echo >&2 "$i does not exist" &&
68-
exit 1
69-
fi
57+
test_path_is_dir "$i" || exit 1
7058
done
7159
)
7260
'
@@ -78,25 +66,13 @@ test_expect_success 'git svn mkdirs -r works' '
7866
git svn mkdirs -r7 &&
7967
for i in a b c d d/e d/e/f "weird file name"
8068
do
81-
if ! test -d "$i"
82-
then
83-
echo >&2 "$i does not exist" &&
84-
exit 1
85-
fi
69+
test_path_is_dir "$i" || exit 1
8670
done &&
8771
88-
if test -d "! !"
89-
then
90-
echo >&2 "$i should not exist" &&
91-
exit 1
92-
fi &&
72+
test_path_is_missing "! !" || exit 1 &&
9373
9474
git svn mkdirs -r8 &&
95-
if ! test -d "! !"
96-
then
97-
echo >&2 "$i not exist" &&
98-
exit 1
99-
fi
75+
test_path_is_dir "! !" || exit 1
10076
)
10177
'
10278

@@ -114,11 +90,7 @@ test_expect_success 'empty directories in trunk exist' '
11490
cd trunk &&
11591
for i in a "weird file name"
11692
do
117-
if ! test -d "$i"
118-
then
119-
echo >&2 "$i does not exist" &&
120-
exit 1
121-
fi
93+
test_path_is_dir "$i" || exit 1
12294
done
12395
)
12496
'
@@ -129,7 +101,7 @@ test_expect_success 'remove a top-level directory from svn' '
129101

130102
test_expect_success 'removed top-level directory does not exist' '
131103
git svn clone "$svnrepo" removed &&
132-
test ! -e removed/d
104+
test_path_is_missing removed/d
133105
134106
'
135107
unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
@@ -143,15 +115,11 @@ test_expect_success 'git svn gc-ed files work' '
143115
svn_cmd mkdir -m gz "$svnrepo"/gz &&
144116
git reset --hard $(git rev-list HEAD | tail -1) &&
145117
git svn rebase &&
146-
test -f "$unhandled".gz &&
147-
test -f "$unhandled" &&
118+
test_path_is_file "$unhandled".gz &&
119+
test_path_is_file "$unhandled" &&
148120
for i in a b c "weird file name" gz "! !"
149121
do
150-
if ! test -d "$i"
151-
then
152-
echo >&2 "$i does not exist" &&
153-
exit 1
154-
fi
122+
test_path_is_dir "$i" || exit 1
155123
done
156124
fi
157125
)

0 commit comments

Comments
 (0)