Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-09-25 23:25:19 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2021-09-25 23:35:17 +0300
commit62e433131b289ea90e465cf0c5f78c8c226fc692 (patch)
tree2279c66136d95f1b77484aec147608fe458e8095 /shell
parentd84a604830a7ee3f8fb5f3908ae0d54513393a20 (diff)
shell: enable more tests which are passing now
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash_test/ash-arith/arith.right58
-rwxr-xr-xshell/ash_test/ash-arith/arith.tests45
-rwxr-xr-xshell/ash_test/ash-arith/arith2.sub14
-rw-r--r--shell/hush_test/hush-arith/arith.right17
-rwxr-xr-xshell/hush_test/hush-arith/arith.tests30
-rwxr-xr-xshell/hush_test/hush-arith/arith2.sub14
6 files changed, 105 insertions, 73 deletions
diff --git a/shell/ash_test/ash-arith/arith.right b/shell/ash_test/ash-arith/arith.right
index 99ef825f5..61fcab55e 100644
--- a/shell/ash_test/ash-arith/arith.right
+++ b/shell/ash_test/ash-arith/arith.right
@@ -43,40 +43,60 @@ Format: 'expected actual'
4 4
29 29
5 5
+unary plus, minus
-4 -4
4 4
+conditional expressions
1 1
32 32
32 32
1 1
1 1
32 32
+check that the unevaluated part of the ternary operator does not do evaluation or assignment
20 20
30 30
20 20
30 30
-./arith.tests: line 117: arithmetic syntax error
+check precedence of assignment vs. conditional operator
+./arith.tests: line 116: arithmetic syntax error
+check precedence of assignment vs. conditional operator
+associativity of assignment-operator operator
6 6
6,5,3 6,5,3
+octal, hex
263 263
255 255
40 40
-./arith.tests: line 163: arithmetic syntax error
-./arith.tests: line 165: divide by zero
-./arith.tests: let: line 166: arithmetic syntax error
-./arith.tests: line 167: arithmetic syntax error
-./arith.tests: let: line 168: arithmetic syntax error
+other bases
+10 10
+10 10
+10 10
+10 10
+10 10
+10 10
+36 36
+36 36
+62 62
+63 63
+missing number after base
+0 0
+./arith.tests: line 162: arithmetic syntax error
+./arith.tests: line 164: divide by zero
+./arith.tests: let: line 165: arithmetic syntax error
+./arith.tests: line 166: arithmetic syntax error
+./arith.tests: let: line 167: arithmetic syntax error
abc
def
ghi
-./arith.tests: line 191: arithmetic syntax error
+./arith.tests: line 190: arithmetic syntax error
16 16
-./arith.tests: line 196: arithmetic syntax error
-./arith.tests: line 197: malformed ?: operator
-./arith.tests: line 198: arithmetic syntax error
+./arith.tests: line 195: arithmetic syntax error
+./arith.tests: line 196: malformed ?: operator
+./arith.tests: line 197: arithmetic syntax error
9 9
-./arith.tests: line 205: arithmetic syntax error
-./arith.tests: line 208: arithmetic syntax error
+./arith.tests: line 204: arithmetic syntax error
+./arith.tests: line 207: arithmetic syntax error
9 9
9 9
9 9
@@ -98,11 +118,11 @@ ghi
4 4
4 4
7 7
-./arith.tests: line 257: arithmetic syntax error
+./arith.tests: line 256: arithmetic syntax error
+./arith.tests: line 258: arithmetic syntax error
./arith.tests: line 259: arithmetic syntax error
-./arith.tests: line 260: arithmetic syntax error
+./arith.tests: line 261: arithmetic syntax error
./arith.tests: line 262: arithmetic syntax error
-./arith.tests: line 263: arithmetic syntax error
4 4
7 7
-7 -7
@@ -140,9 +160,13 @@ ghi
-7
7
7
+-7 -7
+-7 -7
+7 7
+7 7
8 12
-./arith.tests: line 290: arithmetic syntax error
+./arith.tests: line 289: arithmetic syntax error
42
42
42
-./arith.tests: line 302: a[b[c]d]=e: not found
+./arith.tests: line 301: a[b[c]d]=e: not found
diff --git a/shell/ash_test/ash-arith/arith.tests b/shell/ash_test/ash-arith/arith.tests
index 746ccab71..b9cb8ba4c 100755
--- a/shell/ash_test/ash-arith/arith.tests
+++ b/shell/ash_test/ash-arith/arith.tests
@@ -75,11 +75,11 @@ echo 4 $(( iv &= 4 ))
echo 29 $(( iv += (jv + 9)))
echo 5 $(( (iv + 4) % 7 ))
-# unary plus, minus
+echo unary plus, minus
echo -4 $(( +4 - 8 ))
echo 4 $(( -4 + 8 ))
-# conditional expressions
+echo conditional expressions
echo 1 $(( 4<5 ? 1 : 32))
echo 32 $(( 4>5 ? 1 : 32))
echo 32 $(( 4>(2+3) ? 1 : 32))
@@ -87,8 +87,7 @@ echo 1 $(( 4<(2+3) ? 1 : 32))
echo 1 $(( (2+2)<(2+3) ? 1 : 32))
echo 32 $(( (2+2)>(2+3) ? 1 : 32))
-# check that the unevaluated part of the ternary operator does not do
-# evaluation or assignment
+echo check that the unevaluated part of the ternary operator does not do evaluation or assignment
x=i+=2
y=j+=2
#ash# declare -i i=1 j=1
@@ -109,20 +108,20 @@ echo 20 $((1 ? 20 : (x+=2)))
echo 30 $((0 ? (y+=2) : 30))
#ash# echo $i,$y # ash mishandles this
-# check precedence of assignment vs. conditional operator
+echo check precedence of assignment vs. conditional operator
# should be an error
#ash# declare -i x=2
x=2
#ashnote# bash reports error but continues, ash aborts - using subshell to 'emulate' bash:
( y=$((1 ? 20 : x+=2)) )
-# check precedence of assignment vs. conditional operator
+echo check precedence of assignment vs. conditional operator
#ash# declare -i x=2
x=2
# ash says "line NNN: syntax error: 0 ? x+=2 : 20"
#ash# echo 20 $((0 ? x+=2 : 20))
-# associativity of assignment-operator operator
+echo associativity of assignment-operator operator
#ash# declare -i i=1 j=2 k=3
i=1
j=2
@@ -130,7 +129,7 @@ k=3
echo 6 $((i += j += k))
echo 6,5,3 $i,$j,$k
-# octal, hex
+echo octal, hex
echo 263 $(( 0x100 | 007 ))
echo 255 $(( 0xff ))
#ash# echo 255 $(( 16#ff ))
@@ -139,25 +138,25 @@ echo 255 $(( 0xff ))
echo 40 $(( 8 ^ 32 ))
-#ash# # other bases
-#ash# echo 10 $(( 16#a ))
-#ash# echo 10 $(( 32#a ))
-#ash# echo 10 $(( 56#a ))
-#ash# echo 10 $(( 64#a ))
-#ash#
-#ash# echo 10 $(( 16#A ))
-#ash# echo 10 $(( 32#A ))
-#ash# echo 36 $(( 56#A ))
-#ash# echo 36 $(( 64#A ))
-#ash#
-#ash# echo 62 $(( 64#@ ))
-#ash# echo 63 $(( 64#_ ))
+echo other bases
+echo 10 $(( 16#a ))
+echo 10 $(( 32#a ))
+echo 10 $(( 56#a ))
+echo 10 $(( 64#a ))
+
+echo 10 $(( 16#A ))
+echo 10 $(( 32#A ))
+echo 36 $(( 56#A ))
+echo 36 $(( 64#A ))
+
+echo 62 $(( 64#@ ))
+echo 63 $(( 64#_ ))
#ash# # weird bases (error)
#ash# echo $(( 3425#56 ))
-#ash# # missing number after base
-#ash# echo 0 $(( 2# ))
+echo missing number after base
+echo 0 $(( 2# ))
# these should generate errors
( echo $(( 7 = 43 )) )
diff --git a/shell/ash_test/ash-arith/arith2.sub b/shell/ash_test/ash-arith/arith2.sub
index 29f9471d6..8d7918114 100755
--- a/shell/ash_test/ash-arith/arith2.sub
+++ b/shell/ash_test/ash-arith/arith2.sub
@@ -46,12 +46,8 @@ echo $(( ---7 ))
echo $(( ++7 ))
( echo $(( ++ + 7 )) )
-# bash 3.2: -7
-#ash# echo -7 $(( ++-7 ))
-# bash 3.2: -7
-#ash# echo -7 $(( ++ - 7 ))
-
-# bash 3.2: 7
-#ash# echo 7 $(( +--7 ))
-# bash 3.2: 7
-#ash# echo 7 $(( -- + 7 ))
+echo -7 $(( ++-7 ))
+echo -7 $(( ++ - 7 ))
+
+echo 7 $(( +--7 ))
+echo 7 $(( -- + 7 ))
diff --git a/shell/hush_test/hush-arith/arith.right b/shell/hush_test/hush-arith/arith.right
index 2c389caea..a8612295e 100644
--- a/shell/hush_test/hush-arith/arith.right
+++ b/shell/hush_test/hush-arith/arith.right
@@ -70,6 +70,19 @@ octal, hex
263 263
255 255
40 40
+other bases
+10 10
+10 10
+10 10
+10 10
+10 10
+10 10
+36 36
+36 36
+62 62
+63 63
+missing number after base
+0 0
hush: arithmetic syntax error
hush: divide by zero
hush: can't execute 'let': No such file or directory
@@ -149,6 +162,10 @@ hush: arithmetic syntax error
-7
7
7
+-7 -7
+-7 -7
+7 7
+7 7
8 12
hush: arithmetic syntax error
42
diff --git a/shell/hush_test/hush-arith/arith.tests b/shell/hush_test/hush-arith/arith.tests
index a7aded17d..6b707486c 100755
--- a/shell/hush_test/hush-arith/arith.tests
+++ b/shell/hush_test/hush-arith/arith.tests
@@ -142,25 +142,25 @@ echo 255 $(( 0xff ))
echo 40 $(( 8 ^ 32 ))
-#ash# # other bases
-#ash# echo 10 $(( 16#a ))
-#ash# echo 10 $(( 32#a ))
-#ash# echo 10 $(( 56#a ))
-#ash# echo 10 $(( 64#a ))
-#ash#
-#ash# echo 10 $(( 16#A ))
-#ash# echo 10 $(( 32#A ))
-#ash# echo 36 $(( 56#A ))
-#ash# echo 36 $(( 64#A ))
-#ash#
-#ash# echo 62 $(( 64#@ ))
-#ash# echo 63 $(( 64#_ ))
+echo other bases
+echo 10 $(( 16#a ))
+echo 10 $(( 32#a ))
+echo 10 $(( 56#a ))
+echo 10 $(( 64#a ))
+
+echo 10 $(( 16#A ))
+echo 10 $(( 32#A ))
+echo 36 $(( 56#A ))
+echo 36 $(( 64#A ))
+
+echo 62 $(( 64#@ ))
+echo 63 $(( 64#_ ))
#ash# # weird bases (error)
#ash# echo $(( 3425#56 ))
-#ash# # missing number after base
-#ash# echo 0 $(( 2# ))
+echo missing number after base
+echo 0 $(( 2# ))
# these should generate errors
( echo $(( 7 = 43 )) )
diff --git a/shell/hush_test/hush-arith/arith2.sub b/shell/hush_test/hush-arith/arith2.sub
index 29f9471d6..8d7918114 100755
--- a/shell/hush_test/hush-arith/arith2.sub
+++ b/shell/hush_test/hush-arith/arith2.sub
@@ -46,12 +46,8 @@ echo $(( ---7 ))
echo $(( ++7 ))
( echo $(( ++ + 7 )) )
-# bash 3.2: -7
-#ash# echo -7 $(( ++-7 ))
-# bash 3.2: -7
-#ash# echo -7 $(( ++ - 7 ))
-
-# bash 3.2: 7
-#ash# echo 7 $(( +--7 ))
-# bash 3.2: 7
-#ash# echo 7 $(( -- + 7 ))
+echo -7 $(( ++-7 ))
+echo -7 $(( ++ - 7 ))
+
+echo 7 $(( +--7 ))
+echo 7 $(( -- + 7 ))