Added another regression test which is currently commented out, since it

is not yet fixed.
This commit is contained in:
rillig 2006-05-12 00:05:59 +00:00
parent ce51c72be5
commit cbe8405661
2 changed files with 31 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.9 2005/12/10 14:22:17 yamt Exp $
# $NetBSD: Makefile,v 1.10 2006/05/12 00:05:59 rillig Exp $
NOMAN= # defined
@ -10,5 +10,6 @@ regress:
sh ${.CURDIR}/fsplit.sh
sh ${.CURDIR}/here.sh
sh ${.CURDIR}/set_e.sh
#sh ${.CURDIR}/expand.sh # First needs to be fixed.
.include <bsd.prog.mk>

29
regress/bin/sh/expand.sh Executable file
View File

@ -0,0 +1,29 @@
#! /bin/sh
# $NetBSD: expand.sh,v 1.1 2006/05/12 00:05:59 rillig Exp $
#
#
# This file tests the functions in expand.c.
#
set -e
# usage: assert_equals <testname> <expected> <got>
assert_equals() {
if test "$2" != "$3"; then
echo "FAIL in testcase $1: expected [$2], got [$3]" 1>&2
false
fi
}
#
# Somewhere between 2.0.2 and 3.0 the expansion of the $@ variable had
# been broken.
#
got=`echo "" "" | sed 's,$,EOL,'` # This one should work everywhere.
assert_equals "1" " EOL" "$got"
set -- "" "" # This code triggered the bug.
got=`echo "$@" | sed 's,$,EOL,'`
assert_equals "2" " EOL" "$got"