equal
deleted
inserted
replaced
|
1 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 # All rights reserved. |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of the License "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Nokia Corporation - initial contribution. |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # break not inside any loop |
|
15 # |
|
16 |
|
17 init() |
|
18 { |
|
19 let totalno=0; |
|
20 let passno=0; |
|
21 let failno=0; |
|
22 } |
|
23 |
|
24 # @internal test function |
|
25 util_break2() |
|
26 { |
|
27 let totalno=totalno+1 |
|
28 echo "Test $totalno: break not inside any loop" |
|
29 res=`break` |
|
30 } |
|
31 |
|
32 |
|
33 |
|
34 test_break2() |
|
35 { |
|
36 util_break2 |
|
37 ret=$? |
|
38 if [ $ret = 1 ] |
|
39 then |
|
40 echo "PASS" |
|
41 let passno=passno+1 |
|
42 else |
|
43 echo "FAIL: Expected 1, returned $ret" |
|
44 let failno=failno+1 |
|
45 fi |
|
46 } |
|
47 |
|
48 |
|
49 # break 2 levels out |
|
50 test_break3() |
|
51 { |
|
52 let totalno=totalno+1 |
|
53 echo "Test $totalno: break with 2 as argument inside repeat inside for loop, to exit from both" |
|
54 for i in 1 2 3 |
|
55 do |
|
56 repeat 10 break 2 |
|
57 done |
|
58 if [ $i = 1 ] |
|
59 then |
|
60 echo "PASS" |
|
61 let passno=passno+1 |
|
62 else |
|
63 echo "FAIL: Expected 1, returned $ret" |
|
64 let failno=failno+1 |
|
65 fi |
|
66 |
|
67 } |
|
68 |
|
69 report() |
|
70 { |
|
71 echo "#############################################################################" |
|
72 echo "Total tests : $totalno" |
|
73 echo "Passed : $passno" |
|
74 echo "Failed : $failno" |
|
75 echo "#############################################################################" |
|
76 } |
|
77 |
|
78 init |
|
79 # test_break2 |
|
80 test_break3 |
|
81 report |