mirror of
https://github.com/sheumann/hush.git
synced 2024-11-19 08:31:11 +00:00
140ac91fe1
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
34 lines
977 B
Bash
Executable File
34 lines
977 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Readlink tests.
|
|
# Copyright 2006 by Natanael Copa <n@tanael.org>
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
|
|
|
. ./testing.sh
|
|
|
|
TESTDIR=readlink_testdir
|
|
TESTFILE="$TESTDIR/testfile"
|
|
TESTLINK="testlink"
|
|
FAILLINK="$TESTDIR/$TESTDIR/testlink"
|
|
|
|
# create the dir and test files
|
|
mkdir -p "./$TESTDIR"
|
|
touch "./$TESTFILE"
|
|
ln -s "./$TESTFILE" "./$TESTLINK"
|
|
|
|
testing "readlink on a file" "readlink ./$TESTFILE" "" "" ""
|
|
testing "readlink on a link" "readlink ./$TESTLINK" "./$TESTFILE\n" "" ""
|
|
|
|
optional FEATURE_READLINK_FOLLOW
|
|
|
|
testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" ""
|
|
testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" ""
|
|
testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" ""
|
|
testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" ""
|
|
|
|
|
|
# clean up
|
|
rm -r "$TESTLINK" "$TESTDIR"
|
|
|
|
exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
|