blob: 425e583b9bdba3a560d92bf2978159189cf224a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"
|