aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-09-25 22:25:19 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-09-25 22:35:17 +0200
commit62e433131b289ea90e465cf0c5f78c8c226fc692 (patch)
tree2279c66136d95f1b77484aec147608fe458e8095 /shell
parentd84a604830a7ee3f8fb5f3908ae0d54513393a20 (diff)
downloadbusybox-w32-62e433131b289ea90e465cf0c5f78c8c226fc692.tar.gz
busybox-w32-62e433131b289ea90e465cf0c5f78c8c226fc692.tar.bz2
busybox-w32-62e433131b289ea90e465cf0c5f78c8c226fc692.zip
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'
434 4 434 4
4429 29 4429 29
455 5 455 5
46unary plus, minus
46-4 -4 47-4 -4
474 4 484 4
49conditional expressions
481 1 501 1
4932 32 5132 32
5032 32 5232 32
511 1 531 1
521 1 541 1
5332 32 5532 32
56check that the unevaluated part of the ternary operator does not do evaluation or assignment
5420 20 5720 20
5530 30 5830 30
5620 20 5920 20
5730 30 6030 30
58./arith.tests: line 117: arithmetic syntax error 61check precedence of assignment vs. conditional operator
62./arith.tests: line 116: arithmetic syntax error
63check precedence of assignment vs. conditional operator
64associativity of assignment-operator operator
596 6 656 6
606,5,3 6,5,3 666,5,3 6,5,3
67octal, hex
61263 263 68263 263
62255 255 69255 255
6340 40 7040 40
64./arith.tests: line 163: arithmetic syntax error 71other bases
65./arith.tests: line 165: divide by zero 7210 10
66./arith.tests: let: line 166: arithmetic syntax error 7310 10
67./arith.tests: line 167: arithmetic syntax error 7410 10
68./arith.tests: let: line 168: arithmetic syntax error 7510 10
7610 10
7710 10
7836 36
7936 36
8062 62
8163 63
82missing number after base
830 0
84./arith.tests: line 162: arithmetic syntax error
85./arith.tests: line 164: divide by zero
86./arith.tests: let: line 165: arithmetic syntax error
87./arith.tests: line 166: arithmetic syntax error
88./arith.tests: let: line 167: arithmetic syntax error
69abc 89abc
70def 90def
71ghi 91ghi
72./arith.tests: line 191: arithmetic syntax error 92./arith.tests: line 190: arithmetic syntax error
7316 16 9316 16
74./arith.tests: line 196: arithmetic syntax error 94./arith.tests: line 195: arithmetic syntax error
75./arith.tests: line 197: malformed ?: operator 95./arith.tests: line 196: malformed ?: operator
76./arith.tests: line 198: arithmetic syntax error 96./arith.tests: line 197: arithmetic syntax error
779 9 979 9
78./arith.tests: line 205: arithmetic syntax error 98./arith.tests: line 204: arithmetic syntax error
79./arith.tests: line 208: arithmetic syntax error 99./arith.tests: line 207: arithmetic syntax error
809 9 1009 9
819 9 1019 9
829 9 1029 9
@@ -98,11 +118,11 @@ ghi
984 4 1184 4
994 4 1194 4
1007 7 1207 7
101./arith.tests: line 257: arithmetic syntax error 121./arith.tests: line 256: arithmetic syntax error
122./arith.tests: line 258: arithmetic syntax error
102./arith.tests: line 259: arithmetic syntax error 123./arith.tests: line 259: arithmetic syntax error
103./arith.tests: line 260: arithmetic syntax error 124./arith.tests: line 261: arithmetic syntax error
104./arith.tests: line 262: arithmetic syntax error 125./arith.tests: line 262: arithmetic syntax error
105./arith.tests: line 263: arithmetic syntax error
1064 4 1264 4
1077 7 1277 7
108-7 -7 128-7 -7
@@ -140,9 +160,13 @@ ghi
140-7 160-7
1417 1617
1427 1627
163-7 -7
164-7 -7
1657 7
1667 7
1438 12 1678 12
144./arith.tests: line 290: arithmetic syntax error 168./arith.tests: line 289: arithmetic syntax error
14542 16942
14642 17042
14742 17142
148./arith.tests: line 302: a[b[c]d]=e: not found 172./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 ))
75echo 29 $(( iv += (jv + 9))) 75echo 29 $(( iv += (jv + 9)))
76echo 5 $(( (iv + 4) % 7 )) 76echo 5 $(( (iv + 4) % 7 ))
77 77
78# unary plus, minus 78echo unary plus, minus
79echo -4 $(( +4 - 8 )) 79echo -4 $(( +4 - 8 ))
80echo 4 $(( -4 + 8 )) 80echo 4 $(( -4 + 8 ))
81 81
82# conditional expressions 82echo conditional expressions
83echo 1 $(( 4<5 ? 1 : 32)) 83echo 1 $(( 4<5 ? 1 : 32))
84echo 32 $(( 4>5 ? 1 : 32)) 84echo 32 $(( 4>5 ? 1 : 32))
85echo 32 $(( 4>(2+3) ? 1 : 32)) 85echo 32 $(( 4>(2+3) ? 1 : 32))
@@ -87,8 +87,7 @@ echo 1 $(( 4<(2+3) ? 1 : 32))
87echo 1 $(( (2+2)<(2+3) ? 1 : 32)) 87echo 1 $(( (2+2)<(2+3) ? 1 : 32))
88echo 32 $(( (2+2)>(2+3) ? 1 : 32)) 88echo 32 $(( (2+2)>(2+3) ? 1 : 32))
89 89
90# check that the unevaluated part of the ternary operator does not do 90echo check that the unevaluated part of the ternary operator does not do evaluation or assignment
91# evaluation or assignment
92x=i+=2 91x=i+=2
93y=j+=2 92y=j+=2
94#ash# declare -i i=1 j=1 93#ash# declare -i i=1 j=1
@@ -109,20 +108,20 @@ echo 20 $((1 ? 20 : (x+=2)))
109echo 30 $((0 ? (y+=2) : 30)) 108echo 30 $((0 ? (y+=2) : 30))
110#ash# echo $i,$y # ash mishandles this 109#ash# echo $i,$y # ash mishandles this
111 110
112# check precedence of assignment vs. conditional operator 111echo check precedence of assignment vs. conditional operator
113# should be an error 112# should be an error
114#ash# declare -i x=2 113#ash# declare -i x=2
115 x=2 114 x=2
116#ashnote# bash reports error but continues, ash aborts - using subshell to 'emulate' bash: 115#ashnote# bash reports error but continues, ash aborts - using subshell to 'emulate' bash:
117( y=$((1 ? 20 : x+=2)) ) 116( y=$((1 ? 20 : x+=2)) )
118 117
119# check precedence of assignment vs. conditional operator 118echo check precedence of assignment vs. conditional operator
120#ash# declare -i x=2 119#ash# declare -i x=2
121 x=2 120 x=2
122# ash says "line NNN: syntax error: 0 ? x+=2 : 20" 121# ash says "line NNN: syntax error: 0 ? x+=2 : 20"
123#ash# echo 20 $((0 ? x+=2 : 20)) 122#ash# echo 20 $((0 ? x+=2 : 20))
124 123
125# associativity of assignment-operator operator 124echo associativity of assignment-operator operator
126#ash# declare -i i=1 j=2 k=3 125#ash# declare -i i=1 j=2 k=3
127i=1 126i=1
128j=2 127j=2
@@ -130,7 +129,7 @@ k=3
130echo 6 $((i += j += k)) 129echo 6 $((i += j += k))
131echo 6,5,3 $i,$j,$k 130echo 6,5,3 $i,$j,$k
132 131
133# octal, hex 132echo octal, hex
134echo 263 $(( 0x100 | 007 )) 133echo 263 $(( 0x100 | 007 ))
135echo 255 $(( 0xff )) 134echo 255 $(( 0xff ))
136#ash# echo 255 $(( 16#ff )) 135#ash# echo 255 $(( 16#ff ))
@@ -139,25 +138,25 @@ echo 255 $(( 0xff ))
139 138
140echo 40 $(( 8 ^ 32 )) 139echo 40 $(( 8 ^ 32 ))
141 140
142#ash# # other bases 141echo other bases
143#ash# echo 10 $(( 16#a )) 142echo 10 $(( 16#a ))
144#ash# echo 10 $(( 32#a )) 143echo 10 $(( 32#a ))
145#ash# echo 10 $(( 56#a )) 144echo 10 $(( 56#a ))
146#ash# echo 10 $(( 64#a )) 145echo 10 $(( 64#a ))
147#ash# 146
148#ash# echo 10 $(( 16#A )) 147echo 10 $(( 16#A ))
149#ash# echo 10 $(( 32#A )) 148echo 10 $(( 32#A ))
150#ash# echo 36 $(( 56#A )) 149echo 36 $(( 56#A ))
151#ash# echo 36 $(( 64#A )) 150echo 36 $(( 64#A ))
152#ash# 151
153#ash# echo 62 $(( 64#@ )) 152echo 62 $(( 64#@ ))
154#ash# echo 63 $(( 64#_ )) 153echo 63 $(( 64#_ ))
155 154
156#ash# # weird bases (error) 155#ash# # weird bases (error)
157#ash# echo $(( 3425#56 )) 156#ash# echo $(( 3425#56 ))
158 157
159#ash# # missing number after base 158echo missing number after base
160#ash# echo 0 $(( 2# )) 159echo 0 $(( 2# ))
161 160
162# these should generate errors 161# these should generate errors
163( echo $(( 7 = 43 )) ) 162( 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 ))
46echo $(( ++7 )) 46echo $(( ++7 ))
47( echo $(( ++ + 7 )) ) 47( echo $(( ++ + 7 )) )
48 48
49# bash 3.2: -7 49echo -7 $(( ++-7 ))
50#ash# echo -7 $(( ++-7 )) 50echo -7 $(( ++ - 7 ))
51# bash 3.2: -7 51
52#ash# echo -7 $(( ++ - 7 )) 52echo 7 $(( +--7 ))
53 53echo 7 $(( -- + 7 ))
54# bash 3.2: 7
55#ash# echo 7 $(( +--7 ))
56# bash 3.2: 7
57#ash# 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
70263 263 70263 263
71255 255 71255 255
7240 40 7240 40
73other bases
7410 10
7510 10
7610 10
7710 10
7810 10
7910 10
8036 36
8136 36
8262 62
8363 63
84missing number after base
850 0
73hush: arithmetic syntax error 86hush: arithmetic syntax error
74hush: divide by zero 87hush: divide by zero
75hush: can't execute 'let': No such file or directory 88hush: can't execute 'let': No such file or directory
@@ -149,6 +162,10 @@ hush: arithmetic syntax error
149-7 162-7
1507 1637
1517 1647
165-7 -7
166-7 -7
1677 7
1687 7
1528 12 1698 12
153hush: arithmetic syntax error 170hush: arithmetic syntax error
15442 17142
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 ))
142 142
143echo 40 $(( 8 ^ 32 )) 143echo 40 $(( 8 ^ 32 ))
144 144
145#ash# # other bases 145echo other bases
146#ash# echo 10 $(( 16#a )) 146echo 10 $(( 16#a ))
147#ash# echo 10 $(( 32#a )) 147echo 10 $(( 32#a ))
148#ash# echo 10 $(( 56#a )) 148echo 10 $(( 56#a ))
149#ash# echo 10 $(( 64#a )) 149echo 10 $(( 64#a ))
150#ash# 150
151#ash# echo 10 $(( 16#A )) 151echo 10 $(( 16#A ))
152#ash# echo 10 $(( 32#A )) 152echo 10 $(( 32#A ))
153#ash# echo 36 $(( 56#A )) 153echo 36 $(( 56#A ))
154#ash# echo 36 $(( 64#A )) 154echo 36 $(( 64#A ))
155#ash# 155
156#ash# echo 62 $(( 64#@ )) 156echo 62 $(( 64#@ ))
157#ash# echo 63 $(( 64#_ )) 157echo 63 $(( 64#_ ))
158 158
159#ash# # weird bases (error) 159#ash# # weird bases (error)
160#ash# echo $(( 3425#56 )) 160#ash# echo $(( 3425#56 ))
161 161
162#ash# # missing number after base 162echo missing number after base
163#ash# echo 0 $(( 2# )) 163echo 0 $(( 2# ))
164 164
165# these should generate errors 165# these should generate errors
166( echo $(( 7 = 43 )) ) 166( 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 ))
46echo $(( ++7 )) 46echo $(( ++7 ))
47( echo $(( ++ + 7 )) ) 47( echo $(( ++ + 7 )) )
48 48
49# bash 3.2: -7 49echo -7 $(( ++-7 ))
50#ash# echo -7 $(( ++-7 )) 50echo -7 $(( ++ - 7 ))
51# bash 3.2: -7 51
52#ash# echo -7 $(( ++ - 7 )) 52echo 7 $(( +--7 ))
53 53echo 7 $(( -- + 7 ))
54# bash 3.2: 7
55#ash# echo 7 $(( +--7 ))
56# bash 3.2: 7
57#ash# echo 7 $(( -- + 7 ))