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>

HodaSalim committed Feb 2, 2026 at 18:18 UTC 68060b92629b29d9d669a91fd37da220175eaaea
1 file changed +13 -13
t/t9160-git-svn-preserve-empty-dirs.sh
+13 -13
@@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' '
61
62 # "$GIT_REPO"/1 should only contain the placeholder file.
63 test_expect_success 'directory empty from inception' '
64 - test -f "$GIT_REPO"/1/.gitignore &&
64 + test_path_is_file "$GIT_REPO"/1/.gitignore &&
65 test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
66 '
67
68 # "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
69 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 &&
71 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 &&
73 test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
74 '
75
@@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' '
77 # generated for every sub-directory at some point in the repo's history.
78 test_expect_success 'add entry to previously empty directory' '
79 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
81 '
82
83 # 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' '
102
103 # "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
104 test_expect_success 'placeholder namespace conflict with file' '
105 - test -s "$GIT_REPO"/5/.placeholder
105 + test_file_not_empty "$GIT_REPO"/5/.placeholder
106 '
107
108 # "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
109 # should only contain one file: the placeholder.
110 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 &&
113 test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
114 '
115
@@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' '
133
134 # Check that --preserve-empty-dirs and --placeholder-file flag state
135 # 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 &&
138 test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
139 '
140
141 # Check that placeholder files are properly removed when unnecessary,
142 # 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 &&
145 test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
146
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 &&
149 test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
150 '
151