summaryrefslogtreecommitdiff
path: root/shell/ash_test
diff options
context:
space:
mode:
authorDenys Vlasenko2018-01-28 20:13:33 +0100
committerDenys Vlasenko2018-01-28 20:13:33 +0100
commitf19e3c1c6c96e3c709ac732ff70c586521f792d3 (patch)
treef2b16759f1eae8ac09205f0fb29f822d70610a36 /shell/ash_test
parent675d24aeaff29dbce6dc116a4b7c9f6026ed5069 (diff)
downloadbusybox-f19e3c1c6c96e3c709ac732ff70c586521f792d3.zip
busybox-f19e3c1c6c96e3c709ac732ff70c586521f792d3.tar.gz
shell: handle $((NUM++...) like bash does. Closes 10706
function old new delta evaluate_string 680 729 +49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rw-r--r--shell/ash_test/ash-arith/arith-postinc.right5
-rwxr-xr-xshell/ash_test/ash-arith/arith-postinc.tests5
-rw-r--r--shell/ash_test/ash-arith/arith.right4
-rwxr-xr-xshell/ash_test/ash-arith/arith2.sub12
4 files changed, 20 insertions, 6 deletions
diff --git a/shell/ash_test/ash-arith/arith-postinc.right b/shell/ash_test/ash-arith/arith-postinc.right
new file mode 100644
index 0000000..c95ce02
--- /dev/null
+++ b/shell/ash_test/ash-arith/arith-postinc.right
@@ -0,0 +1,5 @@
+1 1
+1 1
+1 1
+1 1
+Ok:0
diff --git a/shell/ash_test/ash-arith/arith-postinc.tests b/shell/ash_test/ash-arith/arith-postinc.tests
new file mode 100755
index 0000000..3fd9bfe
--- /dev/null
+++ b/shell/ash_test/ash-arith/arith-postinc.tests
@@ -0,0 +1,5 @@
+echo 1 $((0++1))
+echo 1 $((0--1))
+x=-1; echo 1 $((0-$x))
+x=+1; echo 1 $((0+$x))
+echo Ok:$?
diff --git a/shell/ash_test/ash-arith/arith.right b/shell/ash_test/ash-arith/arith.right
index 9b9ca8e..6936f12 100644
--- a/shell/ash_test/ash-arith/arith.right
+++ b/shell/ash_test/ash-arith/arith.right
@@ -126,6 +126,10 @@ ghi
./arith2.sub: line 5: arithmetic syntax error
5 5
1 1
+6 6
+2 2
+3 3
+1 1
4 4
0 0
./arith2.sub: line 42: arithmetic syntax error
diff --git a/shell/ash_test/ash-arith/arith2.sub b/shell/ash_test/ash-arith/arith2.sub
index f7e3c92..9105059 100755
--- a/shell/ash_test/ash-arith/arith2.sub
+++ b/shell/ash_test/ash-arith/arith2.sub
@@ -23,14 +23,14 @@
echo 5 $(( 4 + ++a ))
echo 1 $a
-# ash doesn't handle it right...
-#ash# echo 6 $(( 4+++a ))
-#ash# echo 2 $a
+# this is treated as 4 + ++a
+echo 6 $(( 4+++a ))
+echo 2 $a
a=2
-# ash doesn't handle it right...
-#ash# echo 3 $(( 4---a ))
-#ash# echo 1 $a
+# this is treated as 4 - --a
+echo 3 $(( 4---a ))
+echo 1 $a
a=1
echo 4 $(( 4 - -- a ))