From 52e938bac954d6d503e180287bcf657187ef8803 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 19 Feb 2015 10:22:40 +0000 Subject: 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. --- Test/C01arith.ztst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Test') 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 -- cgit 1.4.1