File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,24 @@ test_expect_success POSIX 'real path works on absolute paths' '
158
158
test "$d/$nopath" = "$(test-path-utils real_path "$d/$nopath")"
159
159
'
160
160
161
+ test_expect_success POSIX ' real path removes extra leading slashes' '
162
+ nopath="hopefully-absent-path" &&
163
+ test "/" = "$(test-path-utils real_path "///")" &&
164
+ test "/$nopath" = "$(test-path-utils real_path "///$nopath")" &&
165
+ # Find an existing top-level directory for the remaining tests:
166
+ d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
167
+ test "$d" = "$(test-path-utils real_path "//$d")" &&
168
+ test "$d/$nopath" = "$(test-path-utils real_path "//$d/$nopath")"
169
+ '
170
+
171
+ test_expect_success ' real path removes other extra slashes' '
172
+ nopath="hopefully-absent-path" &&
173
+ # Find an existing top-level directory for the remaining tests:
174
+ d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
175
+ test "$d" = "$(test-path-utils real_path "$d///")" &&
176
+ test "$d/$nopath" = "$(test-path-utils real_path "$d///$nopath")"
177
+ '
178
+
161
179
test_expect_success SYMLINKS ' real path works on symlinks' '
162
180
mkdir first &&
163
181
ln -s ../.git first/.git &&
You can’t perform that action at this time.
0 commit comments