Permalink
Browse files

Make the here doc translation tests more realistic.

  • Loading branch information...
Andy Chu
Andy Chu committed Aug 28, 2018
1 parent 4fbbc61 commit 2701d38b741633c5d945576ff701a43faedd2a0f
Showing with 12 additions and 7 deletions.
  1. +6 −6 test/osh2oil.sh
  2. +6 −1 tools/osh2oil.py
View
@@ -303,11 +303,11 @@ here-doc() {
# DQ context
osh0-oil3 << 'OSH' 3<< 'OIL'
cat <<ONE
echo $hi
echo $hi ${varsub} $((1 + 2)) $(echo comsub)
ONE
OSH
cat << """
echo $hi
echo $hi $(varsub) $(1 + 2) $[echo comsub]
"""
OIL
@@ -325,13 +325,13 @@ OIL
# <<- in DQ context
osh0-oil3 << 'OSH' 3<< 'OIL'
cat <<-ONE
indented
body
indented ${varsub} $((1 + 2))
body $(echo comsub)
ONE
OSH
cat << """
indented
body
indented $(varsub) $(1 + 2)
body $[echo comsub]
"""
OIL
View
@@ -290,7 +290,12 @@ def DoRedirect(self, node, local_symbols):
#self.cursor.SkipUntil(here_begin_spid + 1)
# Now print the lines
# Now print the lines. TODO: Have a flag to indent these to the level of
# the owning command, e.g.
# cat <<EOF
# EOF
# Or since most here docs are the top level, you could just have a hack
# for a fixed indent? TODO: Look at real use cases.
for part in node.stdin_parts:
self.DoWordPart(part, local_symbols)

0 comments on commit 2701d38

Please sign in to comment.