about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-06-02 10:21:55 +0100
committerPeter Stephenson <pws@zsh.org>2015-06-02 10:21:55 +0100
commit099e717c1587951458f9b3bd514c655001125f66 (patch)
tree2260b04957de51bdf4033d9ecd7dad95acbeee13 /Test
parentaab6bdc3661e83216d2e4bc58948ed21d394d3f5 (diff)
downloadzsh-099e717c1587951458f9b3bd514c655001125f66.tar.gz
zsh-099e717c1587951458f9b3bd514c655001125f66.tar.xz
zsh-099e717c1587951458f9b3bd514c655001125f66.zip
35359: Improved math parsing and errors.
Check for bogus trailing ")" at end of top-level parse.

Extend some math error messages to indicate they are math errors.
Diffstat (limited to 'Test')
-rw-r--r--Test/C01arith.ztst22
1 files changed, 18 insertions, 4 deletions
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index d284e0869..c7bd81fc3 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -69,11 +69,11 @@
 
   print $(( 3 ? 2 ))
 1:parsing ternary (1)
-?(eval):1: ':' expected
+?(eval):1: bad math expression: ':' expected
 
   print $(( 3 ? 2 : 1 : 4 ))
 1:parsing ternary (2)
-?(eval):1: ':' without '?'
+?(eval):1: bad math expression: ':' without '?'
 
   print $(( 0, 4 ? 3 : 1, 5 ))
 0:comma operator
@@ -86,7 +86,7 @@
 
   print $((##))
 1:## without following character
-?(eval):1: character missing after ##
+?(eval):1: bad math expression: character missing after ##
 
   print $((## ))
 0:## followed by a space
@@ -126,7 +126,7 @@
 
   print $(( 13 = 42 ))
 1:bad lvalue
-?(eval):1: lvalue required
+?(eval):1: bad math expression: lvalue required
 
   x=/bar
   (( x = 32 ))
@@ -395,3 +395,17 @@
 >6
 >7
 >120
+
+  foo="(1)"
+  print $((foo))
+  print $(($foo))
+  print $(((2)))
+  foo="3)"
+  (print $((foo))) 2>&1
+  (print $(($foo))) 2>&1
+1: Good and bad trailing parentheses
+>1
+>1
+>2
+>(eval):6: bad math expression: unexpected ')'
+>(eval):7: bad math expression: unexpected ')'