]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0060-path-utils.sh
Implement normalize_absolute_path
[thirdparty/git.git] / t / t0060-path-utils.sh
CommitLineData
ae299be0
DR
1#!/bin/sh
2#
3# Copyright (c) 2008 David Reiss
4#
5
6test_description='Test various path utilities'
7
8. ./test-lib.sh
9
10norm_abs() {
11 test_expect_success "normalize absolute" \
12 "test \$(test-path-utils normalize_absolute_path '$1') = '$2'"
13}
14
15norm_abs "" /
16norm_abs / /
17norm_abs // /
18norm_abs /// /
19norm_abs /. /
20norm_abs /./ /
21norm_abs /./.. /
22norm_abs /../. /
23norm_abs /./../.// /
24norm_abs /dir/.. /
25norm_abs /dir/sub/../.. /
26norm_abs /dir /dir
27norm_abs /dir// /dir
28norm_abs /./dir /dir
29norm_abs /dir/. /dir
30norm_abs /dir///./ /dir
31norm_abs /dir//sub/.. /dir
32norm_abs /dir/sub/../ /dir
33norm_abs //dir/sub/../. /dir
34norm_abs /dir/s1/../s2/ /dir/s2
35norm_abs /d1/s1///s2/..//../s3/ /d1/s3
36norm_abs /d1/s1//../s2/../../d2 /d2
37norm_abs /d1/.../d2 /d1/.../d2
38norm_abs /d1/..././../d2 /d1/d2
39
40test_done