From 9431e564aa5a595613929d4b1df82d811701febc Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 5 Mar 2007 21:08:29 +0000 Subject: ash: "here document" testcases --- shell/ash_test/ash-heredoc/heredoc.right | 21 +++++++ shell/ash_test/ash-heredoc/heredoc.tests | 94 ++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 shell/ash_test/ash-heredoc/heredoc.right create mode 100755 shell/ash_test/ash-heredoc/heredoc.tests (limited to 'shell/ash_test') diff --git a/shell/ash_test/ash-heredoc/heredoc.right b/shell/ash_test/ash-heredoc/heredoc.right new file mode 100644 index 000000000..baf115166 --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc.right @@ -0,0 +1,21 @@ +there +one - alpha +two - beta +three - gamma +hi\ +there$a +stuff +hi\ +there +EO\ +F +hi +tab 1 +tab 2 +tab 3 +abc +def ghi +jkl mno +fff is a shell function +hi +there diff --git a/shell/ash_test/ash-heredoc/heredoc.tests b/shell/ash_test/ash-heredoc/heredoc.tests new file mode 100755 index 000000000..31316a58d --- /dev/null +++ b/shell/ash_test/ash-heredoc/heredoc.tests @@ -0,0 +1,94 @@ +# check order and content of multiple here docs + +cat << EOF1 << EOF2 +hi +EOF1 +there +EOF2 + +while read line1; do + read line2 <&3 + echo $line1 - $line2 +done < /tmp/bash-zzz << EOF +abc +EOF +cat >> /tmp/bash-zzz << EOF +def ghi +jkl mno +EOF +cat /tmp/bash-zzz +rm -f /tmp/bash-zzz + +# make sure command printing puts the here-document as the last redirection +# on the line, and the function export code preserves syntactic correctness +fff() +{ + ed /tmp/foo </dev/null +/^name/d +w +q +ENDOFINPUT +aa=1 +} + +type fff +#ash# export -f fff +#ash# ${THIS_SH} -c 'type fff' + +# check that end of file delimits a here-document +# THIS MUST BE LAST! + +cat << EOF +hi +there -- cgit v1.2.3