Add test cases for the command built-in, including its -v and -V options which

I'll commit real soon.

Count the number of found test cases instead of hard-coding them.  Allow an
arbitrary exit status.
This commit is contained in:
Stefan Farfeleder 2005-10-28 14:02:42 +00:00
parent 11dc241777
commit 94cfb3d24c
10 changed files with 58 additions and 3 deletions

View File

@ -0,0 +1,5 @@
# $FreeBSD$
true() {
false
}
command true

View File

@ -0,0 +1,3 @@
# $FreeBSD$
PATH=
command -p cat < /dev/null

View File

@ -0,0 +1,13 @@
# $FreeBSD$
command -v ls
command -v true
command -v /bin/ls
fun() {
}
command -v fun
command -v break
command -v if
alias foo=bar
command -v foo

View File

@ -0,0 +1,7 @@
/bin/ls
true
/bin/ls
fun
break
if
alias foo='bar '

View File

@ -0,0 +1,2 @@
# $FreeBSD$
command -v nonexisting

View File

@ -0,0 +1,14 @@
# $FreeBSD$
command -V ls
command -V true
command -V /bin/ls
fun() {
}
command -V fun
command -V break
command -V if
command -V {
alias foo=bar
command -V foo

View File

@ -0,0 +1,8 @@
ls is /bin/ls
true is a shell builtin
/bin/ls is /bin/ls
fun is a shell function
break is a shell builtin
if is a shell keyword
{ is a shell keyword
foo is an alias for bar

View File

@ -0,0 +1,2 @@
# $FreeBSD$
command -V nonexisting

View File

@ -0,0 +1 @@
nonexisting: not found

View File

@ -1,7 +1,5 @@
# $FreeBSD$
echo '1..42'
COUNTER=1
do_test() {
@ -31,7 +29,9 @@ do_test() {
rm tmp.stdout tmp.stderr
}
TESTS=$(find -s . -name "*.[01]")
TESTS=$(find -Es . -regex ".*\.[0-9]+")
printf "1..%d\n" $(echo ${TESTS} | wc -w)
for i in ${TESTS} ; do
do_test ${i} ${i##*.}
done