diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-13 15:17:14 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-13 15:21:22 +0200 |
commit | 8ccb3f7b1375862f8ef82cd9d225da986b80f054 (patch) | |
tree | 23f0d99fd8f327c8be4d3fb6b783a77c25f965af | |
parent | a4f30f3c70550ee6ceea6768864bfb2e3a99a887 (diff) | |
download | busybox-w32-8ccb3f7b1375862f8ef82cd9d225da986b80f054.tar.gz busybox-w32-8ccb3f7b1375862f8ef82cd9d225da986b80f054.tar.bz2 busybox-w32-8ccb3f7b1375862f8ef82cd9d225da986b80f054.zip |
shell: add a few yet-failing arithmentic tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash_test/ash-arith/arith-assign-in-varexp.right | 3 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith-assign-in-varexp.tests | 8 | ||||
-rw-r--r-- | shell/ash_test/ash-arith/arith-comma1.right | 3 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith-comma1.tests | 6 | ||||
-rw-r--r-- | shell/ash_test/ash-arith/arith-precedence1.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith-precedence1.tests | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-arith/arith-ternary1.right | 5 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith-ternary1.tests | 12 | ||||
-rw-r--r-- | shell/ash_test/ash-arith/arith-ternary2.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith-ternary2.tests | 2 |
10 files changed, 43 insertions, 0 deletions
diff --git a/shell/ash_test/ash-arith/arith-assign-in-varexp.right b/shell/ash_test/ash-arith/arith-assign-in-varexp.right new file mode 100644 index 000000000..06ac80a64 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-assign-in-varexp.right | |||
@@ -0,0 +1,3 @@ | |||
1 | 20:20 | ||
2 | a=b=10 | ||
3 | b=10 | ||
diff --git a/shell/ash_test/ash-arith/arith-assign-in-varexp.tests b/shell/ash_test/ash-arith/arith-assign-in-varexp.tests new file mode 100755 index 000000000..920aaa779 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-assign-in-varexp.tests | |||
@@ -0,0 +1,8 @@ | |||
1 | exec 2>&1 | ||
2 | a='b=10' | ||
3 | b=3 | ||
4 | # The variables should evaluate left-to-right, | ||
5 | # thus b is set to 10 _before_ addition | ||
6 | echo 20:$((a + b)) | ||
7 | echo "a=$a" | ||
8 | echo "b=$b" | ||
diff --git a/shell/ash_test/ash-arith/arith-comma1.right b/shell/ash_test/ash-arith/arith-comma1.right new file mode 100644 index 000000000..be1264cc0 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-comma1.right | |||
@@ -0,0 +1,3 @@ | |||
1 | 10:10 | ||
2 | a=b=10 | ||
3 | b=10 | ||
diff --git a/shell/ash_test/ash-arith/arith-comma1.tests b/shell/ash_test/ash-arith/arith-comma1.tests new file mode 100755 index 000000000..f86304303 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-comma1.tests | |||
@@ -0,0 +1,6 @@ | |||
1 | exec 2>&1 | ||
2 | a='b=10' | ||
3 | b=3 | ||
4 | echo 10:$((a,b)) | ||
5 | echo "a=$a" | ||
6 | echo "b=$b" | ||
diff --git a/shell/ash_test/ash-arith/arith-precedence1.right b/shell/ash_test/ash-arith/arith-precedence1.right new file mode 100644 index 000000000..7f407b5d2 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-precedence1.right | |||
@@ -0,0 +1 @@ | |||
4:4 | |||
diff --git a/shell/ash_test/ash-arith/arith-precedence1.tests b/shell/ash_test/ash-arith/arith-precedence1.tests new file mode 100755 index 000000000..964ae4ee2 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-precedence1.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | exec 2>&1 | ||
2 | echo 4:"$((0 ? 1,2 : 3,4))" | ||
diff --git a/shell/ash_test/ash-arith/arith-ternary1.right b/shell/ash_test/ash-arith/arith-ternary1.right new file mode 100644 index 000000000..c968f1181 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-ternary1.right | |||
@@ -0,0 +1,5 @@ | |||
1 | 42:42 | ||
2 | a=0 | ||
3 | 6:6 | ||
4 | a=b=+err+ | ||
5 | b=6 | ||
diff --git a/shell/ash_test/ash-arith/arith-ternary1.tests b/shell/ash_test/ash-arith/arith-ternary1.tests new file mode 100755 index 000000000..5a54e34b6 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-ternary1.tests | |||
@@ -0,0 +1,12 @@ | |||
1 | exec 2>&1 | ||
2 | a=0 | ||
3 | # The not-taken branch should not evaluate | ||
4 | echo 42:$((1 ? 42 : (a+=2))) | ||
5 | echo "a=$a" | ||
6 | |||
7 | a='b=+err+' | ||
8 | b=5 | ||
9 | # The not-taken branch should not even parse variables | ||
10 | echo 6:$((0 ? a : ++b)) | ||
11 | echo "a=$a" | ||
12 | echo "b=$b" | ||
diff --git a/shell/ash_test/ash-arith/arith-ternary2.right b/shell/ash_test/ash-arith/arith-ternary2.right new file mode 100644 index 000000000..aa54bd925 --- /dev/null +++ b/shell/ash_test/ash-arith/arith-ternary2.right | |||
@@ -0,0 +1 @@ | |||
5:5 | |||
diff --git a/shell/ash_test/ash-arith/arith-ternary2.tests b/shell/ash_test/ash-arith/arith-ternary2.tests new file mode 100755 index 000000000..eefc8e7ce --- /dev/null +++ b/shell/ash_test/ash-arith/arith-ternary2.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | exec 2>&1 | ||
2 | echo 5:$((1?2?3?4?5:6:7:8:9)) | ||