svn commit: trunk/busybox/shell/ash_test: ash-heredoc

vda at busybox.net vda at busybox.net
Mon Mar 5 21:08:30 UTC 2007


Author: vda
Date: 2007-03-05 13:08:29 -0800 (Mon, 05 Mar 2007)
New Revision: 18014

Log:
ash: "here document" testcases


Added:
   trunk/busybox/shell/ash_test/ash-heredoc/
   trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right
   trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests


Changeset:
Added: trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right
===================================================================
--- trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right	                        (rev 0)
+++ trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right	2007-03-05 21:08:29 UTC (rev 18014)
@@ -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

Added: trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests
===================================================================
--- trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests	                        (rev 0)
+++ trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests	2007-03-05 21:08:29 UTC (rev 18014)
@@ -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 <<EOF1 3<<EOF2
+one
+two
+three
+EOF1
+alpha
+beta
+gamma
+EOF2
+
+
+# check quoted here-doc is protected
+
+a=foo
+cat << 'EOF'
+hi\
+there$a
+stuff
+EOF
+
+# check that quoted here-documents don't have \newline processing done
+
+cat << 'EOF'
+hi\
+there
+EO\
+F
+EOF
+true
+
+# check that \newline is removed at start of here-doc
+cat << EO\
+F
+hi
+EOF
+
+#ash# # check that \newline removal works for here-doc delimiter
+#ash# cat << EOF
+#ash# hi
+#ash# EO\
+#ash# F
+
+# check operation of tab removal in here documents
+cat <<- EOF
+	tab 1
+	tab 2
+	tab 3
+	EOF
+
+# check appending of text to file from here document
+rm -f /tmp/bash-zzz
+cat > /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 <<ENDOFINPUT >/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


Property changes on: trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests
___________________________________________________________________
Name: svn:executable
   + *




More information about the busybox-cvs mailing list