Skip to content

Commit

Permalink
t0060: split absolute path test in two to exercise some of it on Windows
Browse files Browse the repository at this point in the history
Only the first half of the test works only on POSIX, the second half
passes on Windows as well.

A later test "real path removes other extra slashes" looks very similar,
but it does not make sense to split it in the same way: When two slashes
are prepended in front of an absolute DOS-style path on Windows, the
meaning of the path is changed (//server/share style), so that the test
cannot pass on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Sixt authored and Junio C Hamano committed Sep 10, 2012
1 parent 379a03a commit bacca78
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions t/t0060-path-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ test_expect_success 'real path rejects the empty string' '
test_must_fail test-path-utils real_path ""
'

test_expect_success POSIX 'real path works on absolute paths' '
test_expect_success POSIX 'real path works on absolute paths 1' '
nopath="hopefully-absent-path" &&
test "/" = "$(test-path-utils real_path "/")" &&
test "/$nopath" = "$(test-path-utils real_path "/$nopath")" &&
test "/$nopath" = "$(test-path-utils real_path "/$nopath")"
'

test_expect_success 'real path works on absolute paths 2' '
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")" &&
Expand Down

0 comments on commit bacca78

Please sign in to comment.