source: vendor/bash/3.1/tests/builtins.tests@ 3253

Last change on this file since 3253 was 3228, checked in by bird, 19 years ago

bash 3.1

File size: 5.3 KB
Line 
1# tests for miscellaneous builtins not tested elsewhere
2set +p
3set +o posix
4
5ulimit -c 0 2>/dev/null
6
7# check that break breaks loops
8for i in a b c; do echo $i; break; echo bad-$i; done
9echo end-1
10for i in a b c; do echo $i; break 1; echo bad-$i; done
11echo end-2
12for i in a b c; do
13 for j in x y z; do
14 echo $i:$j
15 break
16 echo bad-$i
17 done
18 echo end-$i
19done
20echo end-3
21
22# check that break breaks nested loops
23for i in a b c; do
24 for j in x y z; do
25 echo $i:$j
26 break 2
27 echo bad-$i
28 done
29 echo end-$i
30done
31echo end
32
33# check that continue continues loops
34for i in a b c; do echo $i; continue; echo bad-$i ; done
35echo end-1
36for i in a b c; do echo $i; continue 1; echo bad-$i; done
37echo end-2
38for i in a b c; do
39 for j in x y z; do
40 echo $i:$j
41 continue
42 echo bad-$i-$j
43 done
44 echo end-$i
45done
46echo end-3
47
48# check that continue breaks out of nested loops
49for i in a b c; do
50 for j in x y z; do
51 echo $i:$j
52 continue 2
53 echo bad-$i-$j
54 done