summaryrefslogtreecommitdiffstats
path: root/bin/sh/tests
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-09-14 16:46:30 +0000
committerjilles <jilles@FreeBSD.org>2014-09-14 16:46:30 +0000
commitb9a6c69366eef91243d00249b3150fa796518385 (patch)
treef67439daa602d5ef1a9bd0ef8399a57cf116a8aa /bin/sh/tests
parent860c473214cf7b190e22f2237a121ee676076235 (diff)
downloadFreeBSD-src-b9a6c69366eef91243d00249b3150fa796518385.zip
FreeBSD-src-b9a6c69366eef91243d00249b3150fa796518385.tar.gz
sh: Remove arbitrary length limit on << EOF markers.
This also simplifies the code.
Diffstat (limited to 'bin/sh/tests')
-rw-r--r--bin/sh/tests/parser/Makefile1
-rw-r--r--bin/sh/tests/parser/heredoc12.047
2 files changed, 48 insertions, 0 deletions
diff --git a/bin/sh/tests/parser/Makefile b/bin/sh/tests/parser/Makefile
index 4b2e76d..7b77cb8 100644
--- a/bin/sh/tests/parser/Makefile
+++ b/bin/sh/tests/parser/Makefile
@@ -54,6 +54,7 @@ FILES+= heredoc8.0
FILES+= heredoc9.0
FILES+= heredoc10.0
FILES+= heredoc11.0
+FILES+= heredoc12.0
FILES+= no-space1.0
FILES+= no-space2.0
FILES+= only-redir1.0
diff --git a/bin/sh/tests/parser/heredoc12.0 b/bin/sh/tests/parser/heredoc12.0
new file mode 100644
index 0000000..9648384
--- /dev/null
+++ b/bin/sh/tests/parser/heredoc12.0
@@ -0,0 +1,47 @@
+# $FreeBSD$
+
+failures=0
+
+check() {
+ if ! eval "[ $* ]"; then
+ echo "Failed: $*"
+ : $((failures += 1))
+ fi
+}
+
+longmark=`printf %01000d 4`
+longmarkstripped=`printf %0999d 0`
+
+check '"$(cat <<'"$longmark
+$longmark"'
+echo yes)" = "yes"'
+
+check '"$(cat <<\'"$longmark
+$longmark"'
+echo yes)" = "yes"'
+
+check '"$(cat <<'"$longmark
+yes
+$longmark"'
+)" = "yes"'
+
+check '"$(cat <<\'"$longmark
+yes
+$longmark"'
+)" = "yes"'
+
+check '"$(cat <<'"$longmark
+$longmarkstripped
+$longmark.
+$longmark"'
+)" = "'"$longmarkstripped
+$longmark."'"'
+
+check '"$(cat <<\'"$longmark
+$longmarkstripped
+$longmark.
+$longmark"'
+)" = "'"$longmarkstripped
+$longmark."'"'
+
+exit $((failures != 0))
OpenPOWER on IntegriCloud