summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-04-07 07:25:17 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-04-07 07:25:17 +0000
commit87944cf31d612e8d105f61a60f5f567551dbdfc8 (patch)
treece303cbda4db07c5a4f3450e2b6cf3da2e0e726d /regress/usr.bin
parent6f0c8e043c38725e21a6d3ba436f93c066eafc3a (diff)
Tests for dirname(1). From NetBSD with some local changes.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/dirname/Makefile7
-rw-r--r--regress/usr.bin/dirname/dirname.sh27
2 files changed, 34 insertions, 0 deletions
diff --git a/regress/usr.bin/dirname/Makefile b/regress/usr.bin/dirname/Makefile
new file mode 100644
index 00000000000..03ae614252b
--- /dev/null
+++ b/regress/usr.bin/dirname/Makefile
@@ -0,0 +1,7 @@
+# $OpenBSD: Makefile,v 1.1 2005/04/07 07:25:16 otto Exp $
+# $NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $
+
+regress:
+ @sh ${.CURDIR}/dirname.sh
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/dirname/dirname.sh b/regress/usr.bin/dirname/dirname.sh
new file mode 100644
index 00000000000..425e583b9bd
--- /dev/null
+++ b/regress/usr.bin/dirname/dirname.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $OpenBSD: dirname.sh,v 1.1 2005/04/07 07:25:16 otto Exp $
+# $NetBSD: dirname.sh,v 1.1 2005/04/04 16:48:45 peter Exp $
+
+test_dirname()
+{
+ echo "Testing \"$1\""
+ result=`dirname "$1" 2>&1`
+ if [ "$result" != "$2" ]; then
+ echo "Expected \"$2\", but got \"$result\""
+ exit 1
+ fi
+}
+
+test_dirname "/" "/"
+test_dirname "//" "/"
+test_dirname "/usr/bin/" "/usr"
+test_dirname "//usr//bin//" "//usr"
+test_dirname "usr" "."
+test_dirname "\"\"" "."
+test_dirname "/usr" "/"
+test_dirname "/usr/bin" "/usr"
+test_dirname "usr/bin" "usr"
+test_dirname "" "."
+test_dirname "/./" "/"
+test_dirname "///usr//bin//" "///usr"