t0060: verify that real_path() removes extra slashes
Adjusted for Windows by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f4c21e89d7
commit
379a03ad81
@ -158,6 +158,24 @@ test_expect_success POSIX 'real path works on absolute paths' '
|
||||
test "$d/$nopath" = "$(test-path-utils real_path "$d/$nopath")"
|
||||
'
|
||||
|
||||
test_expect_success POSIX 'real path removes extra leading slashes' '
|
||||
nopath="hopefully-absent-path" &&
|
||||
test "/" = "$(test-path-utils real_path "///")" &&
|
||||
test "/$nopath" = "$(test-path-utils real_path "///$nopath")" &&
|
||||
# Find an existing top-level directory for the remaining tests:
|
||||
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
|
||||
test "$d" = "$(test-path-utils real_path "//$d")" &&
|
||||
test "$d/$nopath" = "$(test-path-utils real_path "//$d/$nopath")"
|
||||
'
|
||||
|
||||
test_expect_success 'real path removes other extra slashes' '
|
||||
nopath="hopefully-absent-path" &&
|
||||
# Find an existing top-level directory for the remaining tests:
|
||||
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
|
||||
test "$d" = "$(test-path-utils real_path "$d///")" &&
|
||||
test "$d/$nopath" = "$(test-path-utils real_path "$d///$nopath")"
|
||||
'
|
||||
|
||||
test_expect_success SYMLINKS 'real path works on symlinks' '
|
||||
mkdir first &&
|
||||
ln -s ../.git first/.git &&
|
||||
|
Loading…
Reference in New Issue
Block a user