about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-01-20 17:17:45 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-01-20 17:17:45 +0000
commitf02778f83c9a1dfaae895a52d3a49417a8f340ea (patch)
treed64871036610fa4cbfffc725875c9cc8c701e5e1 /Test
parentaf68ff74cd5e740d69020ad4ff20f1d5a8dcb4de (diff)
downloadzsh-f02778f83c9a1dfaae895a52d3a49417a8f340ea.tar.gz
zsh-f02778f83c9a1dfaae895a52d3a49417a8f340ea.tar.xz
zsh-f02778f83c9a1dfaae895a52d3a49417a8f340ea.zip
27611: cache parameter values in math eval so subscripts are eval'd once
Diffstat (limited to 'Test')
-rw-r--r--Test/C01arith.ztst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 02612bd79..1f0d2d0f3 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -188,3 +188,25 @@
 >0xFF
 >FF
 
+  array=(1)
+  x=0
+  (( array[++x]++ ))
+  print $x
+  print $#array
+  print $array
+0:no double increment for subscript
+>1
+>1
+>2
+
+  # This is a bit naughty...  the value of array
+  # isn't well defined since there's no sequence point
+  # between the increments of x, however we just want
+  # to be sure that in this case, unlike the above,
+  # x does get incremented twice.
+  x=0
+  array=(1 2)
+  (( array[++x] = array[++x] + 1 ))
+  print $x
+0:double increment for repeated expression
+>2