sh: Add already working testcases for $? in here-document.

If the here-document is attached to a compound command or subshell, $?
already works properly. This is both a workaround for bin/41410 and a
requirement for a true fix for bin/41410.

PR:		bin/41410
MFC after:	1 week
This commit is contained in:
Jilles Tjoelker 2011-06-05 12:46:26 +00:00
parent 7de7a90404
commit b17788c1a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222715

View file

@ -0,0 +1,25 @@
# $FreeBSD$
f() { return $1; }
[ `f 42; { cat; } <<EOF
$?
EOF
` = 42 ] || echo compound command bad
[ `f 42; (cat) <<EOF
$?
EOF
` = 42 ] || echo subshell bad
long=`printf %08192d 0`
[ `f 42; { cat; } <<EOF
$long.$?
EOF
` = $long.42 ] || echo long compound command bad
[ `f 42; (cat) <<EOF
$long.$?
EOF
` = $long.42 ] || echo long subshell bad