sh: Add testcase for $? in here-document.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:56:19 +0000 (09:56 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:56:19 +0000 (09:56 -0800)
Obtained-from:  FreeBSD 222715

tools/regression/bin/sh/expansion/heredoc1.0 [new file with mode: 0644]

diff --git a/tools/regression/bin/sh/expansion/heredoc1.0 b/tools/regression/bin/sh/expansion/heredoc1.0
new file mode 100644 (file)
index 0000000..2d6777e
--- /dev/null
@@ -0,0 +1,25 @@
+# $FreeBSD: src/tools/regression/bin/sh/expansion/heredoc1.0,v 1.1 2011/06/05 12:46:26 jilles Exp $
+
+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