mirror of
https://github.com/mirror/busybox.git
synced 2026-06-30 19:57:32 +00:00
shell: add a few yet-failing arithmentic tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
3
shell/ash_test/ash-arith/arith-assign-in-varexp.right
Normal file
3
shell/ash_test/ash-arith/arith-assign-in-varexp.right
Normal file
@@ -0,0 +1,3 @@
|
||||
20:20
|
||||
a=b=10
|
||||
b=10
|
||||
8
shell/ash_test/ash-arith/arith-assign-in-varexp.tests
Executable file
8
shell/ash_test/ash-arith/arith-assign-in-varexp.tests
Executable file
@@ -0,0 +1,8 @@
|
||||
exec 2>&1
|
||||
a='b=10'
|
||||
b=3
|
||||
# The variables should evaluate left-to-right,
|
||||
# thus b is set to 10 _before_ addition
|
||||
echo 20:$((a + b))
|
||||
echo "a=$a"
|
||||
echo "b=$b"
|
||||
3
shell/ash_test/ash-arith/arith-comma1.right
Normal file
3
shell/ash_test/ash-arith/arith-comma1.right
Normal file
@@ -0,0 +1,3 @@
|
||||
10:10
|
||||
a=b=10
|
||||
b=10
|
||||
6
shell/ash_test/ash-arith/arith-comma1.tests
Executable file
6
shell/ash_test/ash-arith/arith-comma1.tests
Executable file
@@ -0,0 +1,6 @@
|
||||
exec 2>&1
|
||||
a='b=10'
|
||||
b=3
|
||||
echo 10:$((a,b))
|
||||
echo "a=$a"
|
||||
echo "b=$b"
|
||||
1
shell/ash_test/ash-arith/arith-precedence1.right
Normal file
1
shell/ash_test/ash-arith/arith-precedence1.right
Normal file
@@ -0,0 +1 @@
|
||||
4:4
|
||||
2
shell/ash_test/ash-arith/arith-precedence1.tests
Executable file
2
shell/ash_test/ash-arith/arith-precedence1.tests
Executable file
@@ -0,0 +1,2 @@
|
||||
exec 2>&1
|
||||
echo 4:"$((0 ? 1,2 : 3,4))"
|
||||
5
shell/ash_test/ash-arith/arith-ternary1.right
Normal file
5
shell/ash_test/ash-arith/arith-ternary1.right
Normal file
@@ -0,0 +1,5 @@
|
||||
42:42
|
||||
a=0
|
||||
6:6
|
||||
a=b=+err+
|
||||
b=6
|
||||
12
shell/ash_test/ash-arith/arith-ternary1.tests
Executable file
12
shell/ash_test/ash-arith/arith-ternary1.tests
Executable file
@@ -0,0 +1,12 @@
|
||||
exec 2>&1
|
||||
a=0
|
||||
# The not-taken branch should not evaluate
|
||||
echo 42:$((1 ? 42 : (a+=2)))
|
||||
echo "a=$a"
|
||||
|
||||
a='b=+err+'
|
||||
b=5
|
||||
# The not-taken branch should not even parse variables
|
||||
echo 6:$((0 ? a : ++b))
|
||||
echo "a=$a"
|
||||
echo "b=$b"
|
||||
1
shell/ash_test/ash-arith/arith-ternary2.right
Normal file
1
shell/ash_test/ash-arith/arith-ternary2.right
Normal file
@@ -0,0 +1 @@
|
||||
5:5
|
||||
2
shell/ash_test/ash-arith/arith-ternary2.tests
Executable file
2
shell/ash_test/ash-arith/arith-ternary2.tests
Executable file
@@ -0,0 +1,2 @@
|
||||
exec 2>&1
|
||||
echo 5:$((1?2?3?4?5:6:7:8:9))
|
||||
Reference in New Issue
Block a user