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:
parent
11dc241777
commit
94cfb3d24c
5
tools/regression/bin/sh/builtins/command1.0
Normal file
5
tools/regression/bin/sh/builtins/command1.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
true() {
|
||||
false
|
||||
}
|
||||
command true
|
3
tools/regression/bin/sh/builtins/command2.0
Normal file
3
tools/regression/bin/sh/builtins/command2.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
PATH=
|
||||
command -p cat < /dev/null
|
13
tools/regression/bin/sh/builtins/command3.0
Normal file
13
tools/regression/bin/sh/builtins/command3.0
Normal 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
|
7
tools/regression/bin/sh/builtins/command3.0.stdout
Normal file
7
tools/regression/bin/sh/builtins/command3.0.stdout
Normal file
@ -0,0 +1,7 @@
|
||||
/bin/ls
|
||||
true
|
||||
/bin/ls
|
||||
fun
|
||||
break
|
||||
if
|
||||
alias foo='bar '
|
2
tools/regression/bin/sh/builtins/command4.127
Normal file
2
tools/regression/bin/sh/builtins/command4.127
Normal file
@ -0,0 +1,2 @@
|
||||
# $FreeBSD$
|
||||
command -v nonexisting
|
14
tools/regression/bin/sh/builtins/command5.0
Normal file
14
tools/regression/bin/sh/builtins/command5.0
Normal 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
|
8
tools/regression/bin/sh/builtins/command5.0.stdout
Normal file
8
tools/regression/bin/sh/builtins/command5.0.stdout
Normal 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
|
2
tools/regression/bin/sh/builtins/command6.127
Normal file
2
tools/regression/bin/sh/builtins/command6.127
Normal file
@ -0,0 +1,2 @@
|
||||
# $FreeBSD$
|
||||
command -V nonexisting
|
1
tools/regression/bin/sh/builtins/command6.127.stdout
Normal file
1
tools/regression/bin/sh/builtins/command6.127.stdout
Normal file
@ -0,0 +1 @@
|
||||
nonexisting: not found
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user