summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-09-11 16:02:41 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-09-11 16:02:41 +0000
commite550c98d69a270a9c6623fe1fd602b5081f4b46c (patch)
tree40facf8ba2d330dc9e6c5a2a101ddac398563818 /Test
parentd88365d964cb521097f70efb21935a776659a7ed (diff)
downloadzsh-e550c98d69a270a9c6623fe1fd602b5081f4b46c.tar.gz
zsh-e550c98d69a270a9c6623fe1fd602b5081f4b46c.zip
30647, 30649: allow underscores in numeric constants
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 1f0d2d0f3..e5845d37f 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -210,3 +210,26 @@
print $x
0:double increment for repeated expression
>2
+
+ # Floating point. Default precision should take care of rounding errors.
+ print $(( 1_0.000_000e0_1 ))
+ # Integer.
+ print $(( 0x_ff_ff_ ))
+ # _ are parts of variable names that don't start with a digit
+ __myvar__=42
+ print $(( __myvar__ + $__myvar__ ))
+ # _ is not part of variable name that does start with a digit
+ # (which are substituted before math eval)
+ set -- 6
+ print $(( $1_000_000 ))
+ # Underscores in expressions with no whitespace
+ print $(( 3_000_+4_000_/2 ))
+ # Underscores may appear in the base descriptor, for what it's worth...
+ print $(( 1_6_#f_f_ ))
+0:underscores in math constants
+>100.
+>65535
+>84
+>6000000
+>5000
+>255