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