summaryrefslogtreecommitdiff
path: root/dirname.test
blob: 3bc45ca3524749b89e6805705a8de08fa3870ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

. ./test-common.sh

#            "test name"       "command to execute" "expected output"
check_stdout "dirname-noarg"   "../dirname"         "" && \
check_stderr "dirname-noarg-stderr" "../dirname" "usage: ../dirname path\n" && \
check_stdout "dirname-non-existing" "../dirname a b c" "" && \
check_stdout "dirname-slash" "../dirname /" "/\n" && \
check_stdout "dirname-dashes-slash" "../dirname -- /" "/\n" && \
check_stdout "dirname-dashes-slash-a" "../dirname -- /a" "/\n"  && \
check_stdout "dirname-doublequotes" "../dirname \"\"" ".\n" && \
check_stdout "dirname-slashes" "../dirname ///" "/\n" && \
check_stdout "dirname-a/b" "../dirname a/b" "a\n" && \
check_stdout "dirname-a/b/" "../dirname a/b/" "a\n" && \
check_stdout "dirname-a/b//" "../dirname a/b//" "a\n" && \
check_stdout "dirname-a" "../dirname a" ".\n" && \
check_stdout "dirname-a/" "../dirname a/" ".\n" && \
check_stdout "dirname-/a/b/c" "../dirname /a/b/c" "/a/b\n" && \
check_stdout "dirname-//a/b/c" "../dirname //a/b/c" "//a/b\n"