@@ -8,15 +8,15 @@ test_description='Test various path utilities'
88. ./test-lib.sh
99
1010norm_path () {
11- expected=$( test-path-utils print_path " $2 " )
11+ expected=$( test-tool path-utils print_path " $2 " )
1212 test_expect_success $3 " normalize path: $1 => $2 " \
13- " test \"\$ (test-path-utils normalize_path_copy '$1 ')\" = '$expected '"
13+ " test \"\$ (test-tool path-utils normalize_path_copy '$1 ')\" = '$expected '"
1414}
1515
1616relative_path () {
17- expected=$( test-path-utils print_path " $3 " )
17+ expected=$( test-tool path-utils print_path " $3 " )
1818 test_expect_success $4 " relative path: $1 $2 => $3 " \
19- " test \"\$ (test-path-utils relative_path '$1 ' '$2 ')\" = '$expected '"
19+ " test \"\$ (test-tool path-utils relative_path '$1 ' '$2 ')\" = '$expected '"
2020}
2121
2222test_submodule_relative_url () {
@@ -37,7 +37,7 @@ test_git_path() {
3737# On Windows, we are using MSYS's bash, which mangles the paths.
3838# Absolute paths are anchored at the MSYS installation directory,
3939# which means that the path / accounts for this many characters:
40- rootoff=$( test-path-utils normalize_path_copy / | wc -c)
40+ rootoff=$( test-tool path-utils normalize_path_copy / | wc -c)
4141# Account for the trailing LF:
4242if test $rootoff = 2; then
4343 rootoff= # we are on Unix
4646 # In MSYS2, the root directory "/" is translated into a Windows
4747 # directory *with* trailing slash. Let's test for that and adjust
4848 # our expected longest ancestor length accordingly.
49- case " $( test-path-utils print_path /) " in
49+ case " $( test-tool path-utils print_path /) " in
5050 * /) rootslash=1;;
5151 * ) rootslash=0;;
5252 esac
@@ -61,7 +61,7 @@ ancestor() {
6161 expected=$(( $expected + $rootoff ))
6262 fi
6363 test_expect_success " longest ancestor: $1 $2 => $expected " \
64- " actual=\$ (test-path-utils longest_ancestor_length '$1 ' '$2 ') &&
64+ " actual=\$ (test-tool path-utils longest_ancestor_length '$1 ' '$2 ') &&
6565 test \"\$ actual\" = '$expected '"
6666}
6767
@@ -77,8 +77,8 @@ case $(uname -s) in
7777 ;;
7878esac
7979
80- test_expect_success basename ' test-path-utils basename'
81- test_expect_success dirname ' test-path-utils dirname'
80+ test_expect_success basename ' test-tool path-utils basename'
81+ test_expect_success dirname ' test-tool path-utils dirname'
8282
8383norm_path " " " "
8484norm_path . " "
@@ -157,48 +157,48 @@ ancestor /foo/bar /foo:/bar 4
157157ancestor /foo/bar /bar -1
158158
159159test_expect_success ' strip_path_suffix' '
160- test c:/msysgit = $(test-path-utils strip_path_suffix \
160+ test c:/msysgit = $(test-tool path-utils strip_path_suffix \
161161 c:/msysgit/libexec//git-core libexec/git-core)
162162'
163163
164164test_expect_success ' absolute path rejects the empty string' '
165- test_must_fail test-path-utils absolute_path ""
165+ test_must_fail test-tool path-utils absolute_path ""
166166'
167167
168168test_expect_success ' real path rejects the empty string' '
169- test_must_fail test-path-utils real_path ""
169+ test_must_fail test-tool path-utils real_path ""
170170'
171171
172172test_expect_success POSIX ' real path works on absolute paths 1' '
173173 nopath="hopefully-absent-path" &&
174- test "/" = "$(test-path-utils real_path "/")" &&
175- test "/$nopath" = "$(test-path-utils real_path "/$nopath")"
174+ test "/" = "$(test-tool path-utils real_path "/")" &&
175+ test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
176176'
177177
178178test_expect_success ' real path works on absolute paths 2' '
179179 nopath="hopefully-absent-path" &&
180180 # Find an existing top-level directory for the remaining tests:
181181 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
182- test "$d" = "$(test-path-utils real_path "$d")" &&
183- test "$d/$nopath" = "$(test-path-utils real_path "$d/$nopath")"
182+ test "$d" = "$(test-tool path-utils real_path "$d")" &&
183+ test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
184184'
185185
186186test_expect_success POSIX ' real path removes extra leading slashes' '
187187 nopath="hopefully-absent-path" &&
188- test "/" = "$(test-path-utils real_path "///")" &&
189- test "/$nopath" = "$(test-path-utils real_path "///$nopath")" &&
188+ test "/" = "$(test-tool path-utils real_path "///")" &&
189+ test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
190190 # Find an existing top-level directory for the remaining tests:
191191 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
192- test "$d" = "$(test-path-utils real_path "//$d")" &&
193- test "$d/$nopath" = "$(test-path-utils real_path "//$d/$nopath")"
192+ test "$d" = "$(test-tool path-utils real_path "//$d")" &&
193+ test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
194194'
195195
196196test_expect_success ' real path removes other extra slashes' '
197197 nopath="hopefully-absent-path" &&
198198 # Find an existing top-level directory for the remaining tests:
199199 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
200- test "$d" = "$(test-path-utils real_path "$d///")" &&
201- test "$d/$nopath" = "$(test-path-utils real_path "$d///$nopath")"
200+ test "$d" = "$(test-tool path-utils real_path "$d///")" &&
201+ test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
202202'
203203
204204test_expect_success SYMLINKS ' real path works on symlinks' '
@@ -209,35 +209,35 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
209209 mkdir third &&
210210 dir="$(cd .git; pwd -P)" &&
211211 dir2=third/../second/other/.git &&
212- test "$dir" = "$(test-path-utils real_path $dir2)" &&
212+ test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
213213 file="$dir"/index &&
214- test "$file" = "$(test-path-utils real_path $dir2/index)" &&
214+ test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
215215 basename=blub &&
216- test "$dir/$basename" = "$(cd .git && test-path-utils real_path "$basename")" &&
216+ test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
217217 ln -s ../first/file .git/syml &&
218218 sym="$(cd first; pwd -P)"/file &&
219- test "$sym" = "$(test-path-utils real_path "$dir2/syml")"
219+ test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
220220'
221221
222222test_expect_success SYMLINKS ' prefix_path works with absolute paths to work tree symlinks' '
223223 ln -s target symlink &&
224- test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
224+ test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
225225'
226226
227227test_expect_success ' prefix_path works with only absolute path to work tree' '
228228 echo "" >expected &&
229- test-path-utils prefix_path prefix "$(pwd)" >actual &&
229+ test-tool path-utils prefix_path prefix "$(pwd)" >actual &&
230230 test_cmp expected actual
231231'
232232
233233test_expect_success ' prefix_path rejects absolute path to dir with same beginning as work tree' '
234- test_must_fail test-path-utils prefix_path prefix "$(pwd)a"
234+ test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a"
235235'
236236
237237test_expect_success SYMLINKS ' prefix_path works with absolute path to a symlink to work tree having same beginning as work tree' '
238238 git init repo &&
239239 ln -s repo repolink &&
240- test "a" = "$(cd repo && test-path-utils prefix_path prefix "$(pwd)/../repolink/a")"
240+ test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
241241'
242242
243243relative_path /foo/a/b/c/ /foo/a/b/ c/
0 commit comments