From 948f015df0fee27f4e2c73b442a75c9434702550 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 14 Mar 2008 11:40:57 +0000 Subject: 24711: fix re-presentation of here-documents munged internally to here-strings --- Test/A04redirect.ztst | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'Test') diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index 2813d0e28..e27442c25 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -82,6 +82,58 @@ >b >c +# The following tests check that output of parsed here-documents works. +# This isn't completely trivial because we convert the here-documents +# internally to here-strings. So we check again that we can output +# the reevaluated here-strings correctly. Hence there are three slightly +# different stages. We don't care how the output actually looks, so +# we don't test that. + heretest() { + print First line + cat <<-HERE + $foo$foo met celeste 'but with extra' "stuff to test quoting" + HERE + print Last line + } + heretest + eval "$(functions heretest)" + heretest + eval "$(functions heretest)" + heretest +0:Re-evaluation of function output with here document, unquoted +>First line +>barbar met celeste 'but with extra' "stuff to test quoting" +>Last line +>First line +>barbar met celeste 'but with extra' "stuff to test quoting" +>Last line +>First line +>barbar met celeste 'but with extra' "stuff to test quoting" +>Last line + + heretest() { + print First line + cat <<' HERE' + $foo$foo met celeste 'but with extra' "stuff to test quoting" + HERE + print Last line + } + heretest + eval "$(functions heretest)" + heretest + eval "$(functions heretest)" + heretest +0:Re-evaluation of function output with here document, quoted +>First line +> $foo$foo met celeste 'but with extra' "stuff to test quoting" +>Last line +>First line +> $foo$foo met celeste 'but with extra' "stuff to test quoting" +>Last line +>First line +> $foo$foo met celeste 'but with extra' "stuff to test quoting" +>Last line + # # exec tests: perform these in subshells so if they fail the # shell won't exit. -- cgit 1.4.1