openenvutils/commandshell/shell/test/scripts/evaltest.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 
       
    24 # Read the arguments as input to the shell and execute the resulting command in the current shell process with EVALLINENO option unset
       
    25 test_eval2()
       
    26 {
       
    27 let totalno=totalno+1
       
    28 echo "Test $totalno: eval to run a command with EVALLINENO option unset"
       
    29 unsetopt EVALLINENO
       
    30 evalvar=pwd
       
    31 outputvar=`eval $evalvar`
       
    32 ret=$?
       
    33 if [ $ret = 0 ]
       
    34 then
       
    35     if [ $PWD = $outputvar ]
       
    36     then
       
    37         echo "PASS"
       
    38         let passno=passno+1
       
    39     else
       
    40         echo "FAIL: Expected $PWD, returned $outputvar"
       
    41         let failno=failno+1
       
    42     fi
       
    43 else
       
    44     echo "FAIL: Expected return value 0, returned $ret"
       
    45     let failno=failno+1
       
    46 fi
       
    47 setopt EVALLINENO
       
    48 }
       
    49 
       
    50 report()
       
    51     {
       
    52     echo "#############################################################################"
       
    53     echo "Total tests : $totalno"
       
    54     echo "Passed      : $passno"
       
    55     echo "Failed      : $failno"
       
    56     echo "#############################################################################"
       
    57     }
       
    58 
       
    59 
       
    60 init
       
    61 test_eval2
       
    62 report