Skip to content

Commit ad3cb1e

Browse files
author
Andy C
committed
[spec/divergence] Test cases for closing (( and $(( - #2337
1 parent 6c08081 commit ad3cb1e

File tree

1 file changed

+58
-30
lines changed

1 file changed

+58
-30
lines changed

spec/divergence.test.sh

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## compare_shells: bash dash mksh zsh ash
2-
## oils_failures_allowed: 7
2+
## oils_failures_allowed: 9
33

44
# This file relates to:
55
#
@@ -35,35 +35,6 @@ echo "-$dirprefix-"
3535
## N-I mksh/zsh STDOUT:
3636
## END
3737

38-
39-
#### ((( with nested subshells
40-
41-
# https://oilshell.zulipchat.com/#narrow/channel/502349-osh/topic/.28.28.28.20not.20parsed.20like.20bash/with/518874141
42-
43-
# spaces help
44-
good() {
45-
cputype=`( ( (grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
46-
}
47-
48-
bad() {
49-
cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
50-
#echo cputype=$cputype
51-
}
52-
53-
good
54-
bad
55-
56-
## STDOUT:
57-
## END
58-
59-
#### Nested subshell (#2398)
60-
61-
# found on line 137 of the zdiff util from gzip
62-
((echo foo) | tr o 0)
63-
## STDOUT:
64-
f00
65-
## END
66-
6738
#### !( as negation and subshell versus extended glob - #2463
6839

6940
have_icu_uc=false
@@ -186,3 +157,60 @@ status=0
186157
status=0
187158
status=0
188159
## END
160+
161+
#### (( closed with ) ) after multiple lines - #2337
162+
163+
(( echo 1
164+
echo 2
165+
echo 3
166+
) )
167+
168+
## STDOUT:
169+
1
170+
2
171+
3
172+
## END
173+
174+
#### $(( closed with ) ) after multiple lines - #2337
175+
176+
echo $(( echo 1
177+
echo 2
178+
echo 3
179+
) )
180+
181+
## STDOUT:
182+
1 2 3
183+
## END
184+
185+
## BUG dash/ash status: 2
186+
## BUG dash/ash STDOUT:
187+
## END
188+
189+
#### Nested subshell with ((( - #2337
190+
191+
# https://oilshell.zulipchat.com/#narrow/channel/502349-osh/topic/.28.28.28.20not.20parsed.20like.20bash/with/518874141
192+
193+
# spaces help
194+
good() {
195+
cputype=`( ( (grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
196+
}
197+
198+
bad() {
199+
cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
200+
#echo cputype=$cputype
201+
}
202+
203+
good
204+
bad
205+
206+
## STDOUT:
207+
## END
208+
209+
#### Nested subshell with (( - zdiff #2337
210+
211+
# found on line 137 of the zdiff util from gzip
212+
((echo foo) | tr o 0)
213+
## STDOUT:
214+
f00
215+
## END
216+

0 commit comments

Comments
 (0)