Rob Landley | c008c74 | 2006-05-05 21:07:41 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Readlink tests. |
| 4 | # Copyright 2006 by Natanael Copa <n@tanael.org> |
| 5 | # Licensed under GPL v2, see file LICENSE for details. |
| 6 | |
| 7 | . testing.sh |
| 8 | |
| 9 | TESTDIR=readlink_testdir |
| 10 | TESTFILE="$TESTDIR/testfile" |
| 11 | TESTLINK="testlink" |
| 12 | FAILLINK="$TESTDIR/$TESTDIR/testlink" |
| 13 | |
| 14 | # create the dir and test files |
| 15 | mkdir -p "./$TESTDIR" |
| 16 | touch "./$TESTFILE" |
| 17 | ln -s "./$TESTFILE" "./$TESTLINK" |
| 18 | |
| 19 | testing "readlink on a file" "readlink ./$TESTFILE" "" "" "" |
| 20 | testing "readlink on a link" "readlink ./$TESTLINK" "./$TESTFILE\n" "" "" |
Rob Landley | 42bd987 | 2006-05-05 22:22:30 +0000 | [diff] [blame] | 21 | |
| 22 | optional FEATURE_READLINK_FOLLOW |
| 23 | |
Rob Landley | c008c74 | 2006-05-05 21:07:41 +0000 | [diff] [blame] | 24 | testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" "" |
| 25 | testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" "" |
| 26 | testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" "" |
| 27 | testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" "" |
| 28 | |
| 29 | |
| 30 | # clean up |
Denis Vlasenko | 9213a9e | 2006-09-17 16:28:10 +0000 | [diff] [blame] | 31 | rm -r "$TESTLINK" "$TESTDIR" |
Rob Landley | c008c74 | 2006-05-05 21:07:41 +0000 | [diff] [blame] | 32 | |