about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-02-19 10:22:40 +0000
committerPeter Stephenson <pws@zsh.org>2015-02-19 10:22:40 +0000
commit52e938bac954d6d503e180287bcf657187ef8803 (patch)
tree9ecb73af443d7a2953c39462a3c55ad181ac8cc8 /Test
parent9b21dcada9d678da6d23c7e03c68eca926e3ff3e (diff)
downloadzsh-52e938bac954d6d503e180287bcf657187ef8803.tar.gz
zsh-52e938bac954d6d503e180287bcf657187ef8803.tar.xz
zsh-52e938bac954d6d503e180287bcf657187ef8803.zip
34570: Another nasty command / math substituion thing.
Mark arithmetic substitutions with tokens to make sure the substitution
go knows what to do.  Before it was guessing by counting the
parentheses at the end.
Diffstat (limited to 'Test')
-rw-r--r--Test/C01arith.ztst23
1 files changed, 23 insertions, 0 deletions
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 09c08224e..67d78ee13 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -353,3 +353,26 @@
   '
 0:Non-arithmetic subst with command subsitution parse from hell
 >yes, this one after case in subshell
+
+  print "a$((echo one subst)
+  (echo two subst))b"
+0:Another tricky case that is actually a command substitution
+>aone subst
+>two substb
+
+  print "x$((echo one frob); (echo two frob))y"
+0:Same on a single line
+>xone frob
+>two froby
+
+  # This case actually only works by accident: if it wasn't for the
+  # unbalanced parenthesis this would be a valid math substitution.
+  # Hence it's definitely not recommended code.  However, it does give
+  # the algorithm an extra check.
+  print $((case foo in
+  foo)
+  print Worked OK
+  ;;
+  esac))
+0:Would-be math expansion with extra parenthesis making it a cmd subst
+>Worked OK