openenvutils/commandshell/shell/test/scripts/continuetest.sh
changeset 0 2e3d3ce01487
child 1 0fdb7f6b0309
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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 #
       
    15 
       
    16 init()
       
    17     {
       
    18     let totalno=0;
       
    19     let passno=0;
       
    20     let failno=0;
       
    21     }
       
    22 
       
    23 # break 1 level and try to continue.
       
    24 test_continue2()
       
    25 {
       
    26 let totalno=totalno+1
       
    27 echo "Test $totalno: continue within while loop"
       
    28 let var=1
       
    29 while [ $var = 1 ]
       
    30 do
       
    31     if [ $var = 1 ]
       
    32     then
       
    33         let var=2
       
    34         continue 2 
       
    35     fi
       
    36     let var=3
       
    37 done
       
    38 if [ $var = 2 ]
       
    39 then
       
    40    echo "PASS"
       
    41    let passno=passno+1
       
    42 else
       
    43    echo "FAIL: Expected value 2, returned $var"
       
    44    let failno=failno+1
       
    45 fi
       
    46 }
       
    47 
       
    48 # @internal test function
       
    49 util_continue3()
       
    50 {
       
    51 res=`continue`
       
    52 }
       
    53 
       
    54 # continue not inside any loop
       
    55 test_continue3()
       
    56 {
       
    57 let totalno=totalno+1
       
    58 echo "Test $totalno: continue not within loop"
       
    59 util_continue3
       
    60 ret=$?
       
    61 if [ $ret = 1 ]
       
    62 then
       
    63    echo "PASS"
       
    64    let passno=passno+1
       
    65 else
       
    66    echo "FAIL: Expected value 1, returned $var"
       
    67    let failno=failno+1
       
    68 fi
       
    69 }
       
    70 
       
    71 
       
    72 report()
       
    73     {
       
    74     echo "#############################################################################"
       
    75     echo "Total tests : $totalno"
       
    76     echo "Passed      : $passno"
       
    77     echo "Failed      : $failno"
       
    78     echo "#############################################################################"
       
    79     }
       
    80 
       
    81 init
       
    82 test_continue2
       
    83 test_continue3
       
    84 report
       
    85