aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-arith
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-09-25 22:04:45 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-09-25 22:04:45 +0200
commitd84a604830a7ee3f8fb5f3908ae0d54513393a20 (patch)
tree3e9dc05e082e41328a84c8eaa3d45f36c2ba5d44 /shell/hush_test/hush-arith
parent627821e42b06adfe6bbc6004d8eeb7c35f65120d (diff)
downloadbusybox-w32-d84a604830a7ee3f8fb5f3908ae0d54513393a20.tar.gz
busybox-w32-d84a604830a7ee3f8fb5f3908ae0d54513393a20.tar.bz2
busybox-w32-d84a604830a7ee3f8fb5f3908ae0d54513393a20.zip
shell: fix arithmentic evaluation of "++7" and such (it is + + 7, i.e. 7)
function old new delta evaluate_string 945 988 +43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-arith')
-rw-r--r--shell/hush_test/hush-arith/arith.right20
-rwxr-xr-xshell/hush_test/hush-arith/arith.tests10
-rwxr-xr-xshell/hush_test/hush-arith/arith1.sub4
-rwxr-xr-xshell/hush_test/hush-arith/arith2.sub10
4 files changed, 25 insertions, 19 deletions
diff --git a/shell/hush_test/hush-arith/arith.right b/shell/hush_test/hush-arith/arith.right
index c48e468a5..2c389caea 100644
--- a/shell/hush_test/hush-arith/arith.right
+++ b/shell/hush_test/hush-arith/arith.right
@@ -106,6 +106,7 @@ hush: arithmetic syntax error
1063 3 1063 3
1074 4 1074 4
1084 4 1084 4
1097 7
109hush: arithmetic syntax error 110hush: arithmetic syntax error
110hush: arithmetic syntax error 111hush: arithmetic syntax error
111hush: arithmetic syntax error 112hush: arithmetic syntax error
@@ -114,6 +115,8 @@ hush: arithmetic syntax error
1144 4 1154 4
1157 7 1167 7
116-7 -7 117-7 -7
1187
1197
117hush: arithmetic syntax error 120hush: arithmetic syntax error
118hush: arithmetic syntax error 121hush: arithmetic syntax error
119hush: arithmetic syntax error 122hush: arithmetic syntax error
@@ -128,11 +131,12 @@ hush: arithmetic syntax error
1282 2 1312 2
129-2 -2 132-2 -2
1301 1 1331 1
131hush: arithmetic syntax error 1347
132hush: arithmetic syntax error 1357
133hush: arithmetic syntax error 1367
134hush: arithmetic syntax error 1377
135hush: arithmetic syntax error 1387
1397
1365 5 1405 5
1371 1 1411 1
1386 6 1426 6
@@ -141,8 +145,10 @@ hush: arithmetic syntax error
1411 1 1451 1
1424 4 1464 4
1430 0 1470 0
144hush: arithmetic syntax error 148-7
145hush: arithmetic syntax error 149-7
1507
1517
1468 12 1528 12
147hush: arithmetic syntax error 153hush: arithmetic syntax error
14842 15442
diff --git a/shell/hush_test/hush-arith/arith.tests b/shell/hush_test/hush-arith/arith.tests
index bc6b341d1..a7aded17d 100755
--- a/shell/hush_test/hush-arith/arith.tests
+++ b/shell/hush_test/hush-arith/arith.tests
@@ -255,8 +255,8 @@ echo 3 $x
255echo 4 $(( ++x )) 255echo 4 $(( ++x ))
256echo 4 $x 256echo 4 $x
257 257
258# bash 3.2 apparently thinks that ++7 is 7 258# ++ is not a inc operator on non-variable, it is the + + sequence
259#ash# echo 7 $(( ++7 )) 259echo 7 $(( ++7 ))
260( echo $(( 7-- )) ) 260( echo $(( 7-- )) )
261 261
262( echo $(( --x=7 )) ) 262( echo $(( --x=7 )) )
@@ -270,9 +270,9 @@ echo 4 $x
270echo 7 $(( +7 )) 270echo 7 $(( +7 ))
271echo -7 $(( -7 )) 271echo -7 $(( -7 ))
272 272
273# bash 3.2 apparently thinks that ++7 is 7 273# ++ is not a inc operator on non-variable, it is the + + sequence
274#ash# echo $(( ++7 )) 274echo $(( ++7 ))
275#ash# echo $(( --7 )) 275echo $(( --7 ))
276 276
277${THIS_SH} ./arith1.sub 277${THIS_SH} ./arith1.sub
278${THIS_SH} ./arith2.sub 278${THIS_SH} ./arith2.sub
diff --git a/shell/hush_test/hush-arith/arith1.sub b/shell/hush_test/hush-arith/arith1.sub
index 80aa99922..a36785c67 100755
--- a/shell/hush_test/hush-arith/arith1.sub
+++ b/shell/hush_test/hush-arith/arith1.sub
@@ -35,6 +35,6 @@ echo 1 $a
35 35
36#ash# (( ++ )) 36#ash# (( ++ ))
37( echo $(( +++7 )) ) 37( echo $(( +++7 )) )
38# bash 3.2 apparently thinks that ++ +7 is 7 38# ++ is not a inc operator on non-variable, it is the + + sequence
39#ash# echo $(( ++ + 7 )) 39echo $(( ++ + 7 ))
40#ash# (( -- )) 40#ash# (( -- ))
diff --git a/shell/hush_test/hush-arith/arith2.sub b/shell/hush_test/hush-arith/arith2.sub
index 9105059db..29f9471d6 100755
--- a/shell/hush_test/hush-arith/arith2.sub
+++ b/shell/hush_test/hush-arith/arith2.sub
@@ -1,4 +1,4 @@
1# bash 3.2 apparently thinks that ++7 is 7 etc 1# ++ and -- are not inc/dec operators on non-variables, they are + + and - - sequences
2( echo $(( --7 )) ) 2( echo $(( --7 )) )
3( echo $(( ++7 )) ) 3( echo $(( ++7 )) )
4( echo $(( -- 7 )) ) 4( echo $(( -- 7 )) )
@@ -37,13 +37,13 @@ echo 4 $(( 4 - -- a ))
37echo 0 $a 37echo 0 $a
38 38
39#ash# (( -- )) 39#ash# (( -- ))
40# bash 3.2 apparently thinks that ---7 is -7 40# -- is not a dec operator on non-variable, it is the - - sequence
41#ash# echo $(( ---7 )) 41echo $(( ---7 ))
42( echo $(( -- - 7 )) ) 42( echo $(( -- - 7 )) )
43 43
44#ash# (( ++ )) 44#ash# (( ++ ))
45# bash 3.2: 7 45# ++ is not a inc operator on non-variable, it is the + + sequence
46#ash# echo 7 $(( ++7 )) 46echo $(( ++7 ))
47( echo $(( ++ + 7 )) ) 47( echo $(( ++ + 7 )) )
48 48
49# bash 3.2: -7 49# bash 3.2: -7