new regression test.

This commit is contained in:
christos 2002-02-14 21:58:27 +00:00
parent 06ea4006cb
commit f1158a3072
3 changed files with 38 additions and 2 deletions

View File

@ -1,8 +1,9 @@
# $NetBSD: Makefile,v 1.2 2002/02/12 20:39:27 christos Exp $
# $NetBSD: Makefile,v 1.3 2002/02/14 21:58:27 christos Exp $
NOMAN= # defined
regress:
sh ${.CURDIR}/varquote.sh
sh ${.CURDIR}/compexit.sh
.include <bsd.prog.mk>

35
regress/bin/sh/compexit.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# The standard
# http://www.opengroup.org/onlinepubs/007904975/utilities/set.html
# says:
#
# -e
#
# When this option is on, if a simple command fails for any of the
# reasons listed in Consequences of Shell Errors or returns an exit
# status value >0, and is not part of the compound list following a
# while, until, or if keyword, and is not a part of an AND or OR list,
# and is not a pipeline preceded by the ! reserved word, then the shell
# shall immediately exit.
check() {
if [ "$1" != "$2" ]
then
echo "expected [$2], found [$1]" 1>&2
exit 1
fi
}
crud() {
set -e
for x in a
do
BAR="foo"
false && echo true
echo mumble
done
}
foo=`crud`
check x$foo "xmumble"

View File

@ -1,4 +1,4 @@
#!obj/sh
#!/bin/sh
# Variable quoting test.
check() {