Skip to content

Commit 68060b9

Browse files
HodaSalimgitster
authored andcommitted
t9160:modernize test path checking
Replace old-style path checks with Git's dedicated test helpers: - test -f → test_path_is_file - test -d → test_path_is_dir - test -s → test_file_not_empty Fix typos with the word "subsequent" Found using: git grep "test -[efd]" t/ This improves test readability and provides better error messages when path checks fail. Signed-off-by: HodaSalim <hoda.s.salim@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 67ad421 commit 68060b9

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

t/t9160-git-svn-preserve-empty-dirs.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' '
6161

6262
# "$GIT_REPO"/1 should only contain the placeholder file.
6363
test_expect_success 'directory empty from inception' '
64-
test -f "$GIT_REPO"/1/.gitignore &&
64+
test_path_is_file "$GIT_REPO"/1/.gitignore &&
6565
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
6666
'
6767

6868
# "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
6969
test_expect_success 'directory empty from subsequent svn commit' '
70-
test -f "$GIT_REPO"/2/.gitignore &&
70+
test_path_is_file "$GIT_REPO"/2/.gitignore &&
7171
test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" &&
72-
test -f "$GIT_REPO"/3/.gitignore &&
72+
test_path_is_file "$GIT_REPO"/3/.gitignore &&
7373
test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
7474
'
7575

7676
# No placeholder files should exist in "$GIT_REPO"/4, even though one was
7777
# generated for every sub-directory at some point in the repo's history.
7878
test_expect_success 'add entry to previously empty directory' '
7979
test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" &&
80-
test -f "$GIT_REPO"/4/a/b/c/foo
80+
test_path_is_file "$GIT_REPO"/4/a/b/c/foo
8181
'
8282

8383
# The HEAD~2 commit should not have introduced .gitignore placeholder files.
@@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' '
102102

103103
# "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
104104
test_expect_success 'placeholder namespace conflict with file' '
105-
test -s "$GIT_REPO"/5/.placeholder
105+
test_file_not_empty "$GIT_REPO"/5/.placeholder
106106
'
107107

108108
# "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
109109
# should only contain one file: the placeholder.
110110
test_expect_success 'placeholder namespace conflict with directory' '
111-
test -d "$GIT_REPO"/6/.placeholder &&
112-
test -f "$GIT_REPO"/6/.placeholder/.placeholder &&
111+
test_path_is_dir "$GIT_REPO"/6/.placeholder &&
112+
test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder &&
113113
test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
114114
'
115115

@@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' '
133133

134134
# Check that --preserve-empty-dirs and --placeholder-file flag state
135135
# stays persistent over multiple invocations.
136-
test_expect_success 'flag persistence during subsqeuent rebase' '
137-
test -f "$GIT_REPO"/7/.placeholder &&
136+
test_expect_success 'flag persistence during subsequent rebase' '
137+
test_path_is_file "$GIT_REPO"/7/.placeholder &&
138138
test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
139139
'
140140

141141
# Check that placeholder files are properly removed when unnecessary,
142142
# even across multiple invocations.
143-
test_expect_success 'placeholder list persistence during subsqeuent rebase' '
144-
test -f "$GIT_REPO"/1/file1.txt &&
143+
test_expect_success 'placeholder list persistence during subsequent rebase' '
144+
test_path_is_file "$GIT_REPO"/1/file1.txt &&
145145
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
146146
147-
test -f "$GIT_REPO"/5/file1.txt &&
148-
test -f "$GIT_REPO"/5/.placeholder &&
147+
test_path_is_file "$GIT_REPO"/5/file1.txt &&
148+
test_path_is_file "$GIT_REPO"/5/.placeholder &&
149149
test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
150150
'
151151

0 commit comments

Comments
 (0)