summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-06-05 12:46:26 +0000
committerjilles <jilles@FreeBSD.org>2011-06-05 12:46:26 +0000
commitc8f0bef5361aefeba950c1f660d51e9a146e0094 (patch)
tree3e2f3192b466d80e0e12a9975932fe17f671fe79 /tools
parent58bf7d3104c5e5f32bfd96ca36c8551c7d94fa53 (diff)
downloadFreeBSD-src-c8f0bef5361aefeba950c1f660d51e9a146e0094.zip
FreeBSD-src-c8f0bef5361aefeba950c1f660d51e9a146e0094.tar.gz
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
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/expansion/heredoc1.025
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/expansion/heredoc1.0 b/tools/regression/bin/sh/expansion/heredoc1.0
new file mode 100644
index 0000000..a67b2da
--- /dev/null
+++ b/tools/regression/bin/sh/expansion/heredoc1.0
@@ -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
OpenPOWER on IntegriCloud