From 8723c51d6b994db26e2f2f8e1a5878f92e8156f2 Mon Sep 17 00:00:00 2001 From: stefanf Date: Fri, 28 Oct 2005 14:02:42 +0000 Subject: 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. --- tools/regression/bin/sh/builtins/command1.0 | 5 +++++ tools/regression/bin/sh/builtins/command2.0 | 3 +++ tools/regression/bin/sh/builtins/command3.0 | 13 +++++++++++++ tools/regression/bin/sh/builtins/command3.0.stdout | 7 +++++++ tools/regression/bin/sh/builtins/command4.127 | 2 ++ tools/regression/bin/sh/builtins/command5.0 | 14 ++++++++++++++ tools/regression/bin/sh/builtins/command5.0.stdout | 8 ++++++++ tools/regression/bin/sh/builtins/command6.127 | 2 ++ tools/regression/bin/sh/builtins/command6.127.stdout | 1 + tools/regression/bin/sh/regress.sh | 6 +++--- 10 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 tools/regression/bin/sh/builtins/command1.0 create mode 100644 tools/regression/bin/sh/builtins/command2.0 create mode 100644 tools/regression/bin/sh/builtins/command3.0 create mode 100644 tools/regression/bin/sh/builtins/command3.0.stdout create mode 100644 tools/regression/bin/sh/builtins/command4.127 create mode 100644 tools/regression/bin/sh/builtins/command5.0 create mode 100644 tools/regression/bin/sh/builtins/command5.0.stdout create mode 100644 tools/regression/bin/sh/builtins/command6.127 create mode 100644 tools/regression/bin/sh/builtins/command6.127.stdout (limited to 'tools/regression') diff --git a/tools/regression/bin/sh/builtins/command1.0 b/tools/regression/bin/sh/builtins/command1.0 new file mode 100644 index 0000000..fd0afdf --- /dev/null +++ b/tools/regression/bin/sh/builtins/command1.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ +true() { + false +} +command true diff --git a/tools/regression/bin/sh/builtins/command2.0 b/tools/regression/bin/sh/builtins/command2.0 new file mode 100644 index 0000000..ff7b5f2 --- /dev/null +++ b/tools/regression/bin/sh/builtins/command2.0 @@ -0,0 +1,3 @@ +# $FreeBSD$ +PATH= +command -p cat < /dev/null diff --git a/tools/regression/bin/sh/builtins/command3.0 b/tools/regression/bin/sh/builtins/command3.0 new file mode 100644 index 0000000..f4ca120 --- /dev/null +++ b/tools/regression/bin/sh/builtins/command3.0 @@ -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 diff --git a/tools/regression/bin/sh/builtins/command3.0.stdout b/tools/regression/bin/sh/builtins/command3.0.stdout new file mode 100644 index 0000000..239c53f --- /dev/null +++ b/tools/regression/bin/sh/builtins/command3.0.stdout @@ -0,0 +1,7 @@ +/bin/ls +true +/bin/ls +fun +break +if +alias foo='bar ' diff --git a/tools/regression/bin/sh/builtins/command4.127 b/tools/regression/bin/sh/builtins/command4.127 new file mode 100644 index 0000000..c66f60f --- /dev/null +++ b/tools/regression/bin/sh/builtins/command4.127 @@ -0,0 +1,2 @@ +# $FreeBSD$ +command -v nonexisting diff --git a/tools/regression/bin/sh/builtins/command5.0 b/tools/regression/bin/sh/builtins/command5.0 new file mode 100644 index 0000000..d94d2f4 --- /dev/null +++ b/tools/regression/bin/sh/builtins/command5.0 @@ -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 diff --git a/tools/regression/bin/sh/builtins/command5.0.stdout b/tools/regression/bin/sh/builtins/command5.0.stdout new file mode 100644 index 0000000..9f6427f --- /dev/null +++ b/tools/regression/bin/sh/builtins/command5.0.stdout @@ -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 diff --git a/tools/regression/bin/sh/builtins/command6.127 b/tools/regression/bin/sh/builtins/command6.127 new file mode 100644 index 0000000..dcd0861 --- /dev/null +++ b/tools/regression/bin/sh/builtins/command6.127 @@ -0,0 +1,2 @@ +# $FreeBSD$ +command -V nonexisting diff --git a/tools/regression/bin/sh/builtins/command6.127.stdout b/tools/regression/bin/sh/builtins/command6.127.stdout new file mode 100644 index 0000000..10fba1f --- /dev/null +++ b/tools/regression/bin/sh/builtins/command6.127.stdout @@ -0,0 +1 @@ +nonexisting: not found diff --git a/tools/regression/bin/sh/regress.sh b/tools/regression/bin/sh/regress.sh index e2767d7..a6889af 100644 --- a/tools/regression/bin/sh/regress.sh +++ b/tools/regression/bin/sh/regress.sh @@ -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 -- cgit v1.1