summaryrefslogtreecommitdiff
path: root/testsuite/readlink.tests
diff options
context:
space:
mode:
authorRob Landley2006-05-05 21:07:41 +0000
committerRob Landley2006-05-05 21:07:41 +0000
commitc008c7440dd0db4b51afba30cc60814577a2090a (patch)
tree307ea3a46f36780aa390596c7a8329ddbc327718 /testsuite/readlink.tests
parent1781188a9d6ee045a72f37b86102380909e04539 (diff)
downloadbusybox-c008c7440dd0db4b51afba30cc60814577a2090a.zip
busybox-c008c7440dd0db4b51afba30cc60814577a2090a.tar.gz
New test from Natanael Copa.
Diffstat (limited to 'testsuite/readlink.tests')
-rw-r--r--testsuite/readlink.tests29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/readlink.tests b/testsuite/readlink.tests
new file mode 100644
index 0000000..5483d97
--- /dev/null
+++ b/testsuite/readlink.tests
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Readlink tests.
+# Copyright 2006 by Natanael Copa <n@tanael.org>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. 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" "" ""
+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"
+