4 # Copyright 2006 by Natanael Copa <n@tanael.org>
5 # Copyright 2021 by Ron Yorston <rmy@pobox.com>
6 # Licensed under GPLv2, see file LICENSE in this source tree.
15 TESTDIR
=realpath_testdir
19 # create the dir and test files
21 ln -s "./$TESTDIR/not_file" "./$TESTLINK1"
22 ln -s "./$TESTDIR/not_file/not_dir" "./$TESTLINK2"
24 # shell's $PWD may leave symlinks unresolved.
25 # "pwd" may be a built-in and have the same problem.
26 # External pwd _can't_ have that problem (current dir on Unix is physical).
29 testing
"realpath on non-existent absolute path 1" "realpath /not_file" "/not_file\n" "" ""
30 testing
"realpath on non-existent absolute path 2" "realpath /not_file/" "/not_file\n" "" ""
31 testing
"realpath on non-existent absolute path 3" "realpath //not_file" "/not_file\n" "" ""
32 testing
"realpath on non-existent absolute path 4" "realpath /not_dir/not_file 2>&1" "realpath: /not_dir/not_file: No such file or directory\n" "" ""
34 testing
"realpath on non-existent local file 1" "realpath $TESTDIR/not_file" "$pwd/$TESTDIR/not_file\n" "" ""
35 testing
"realpath on non-existent local file 2" "realpath $TESTDIR/not_dir/not_file 2>&1" "realpath: $TESTDIR/not_dir/not_file: No such file or directory\n" "" ""
37 testing
"realpath on link to non-existent file 1" "realpath $TESTLINK1" "$pwd/$TESTDIR/not_file\n" "" ""
38 testing
"realpath on link to non-existent file 2" "realpath $TESTLINK2 2>&1" "realpath: $TESTLINK2: No such file or directory\n" "" ""
39 testing
"realpath on link to non-existent file 3" "realpath ./$TESTLINK1" "$pwd/$TESTDIR/not_file\n" "" ""
40 testing
"realpath on link to non-existent file 4" "realpath ./$TESTLINK2 2>&1" "realpath: ./$TESTLINK2: No such file or directory\n" "" ""
43 rm -r "$TESTLINK1" "$TESTLINK2" "$TESTDIR"
45 exit $
((FAILCOUNT
<= 255 ? FAILCOUNT
: 255))