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:
Michael Haggerty 2012-09-07 00:41:04 +02:00 committed by Junio C Hamano
parent f4c21e89d7
commit 379a03ad81

View file

@ -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 &&