openenvutils/commandshell/shell/test/scripts/cdtest2.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 preamble()
       
    24 {
       
    25 mkdir cdtest
       
    26 mkdir dirstest
       
    27 }
       
    28 
       
    29 test_cd1()
       
    30 {
       
    31 let totalno=totalno+1
       
    32 echo "Test $totalno: cd with a "nonexistingdir" as argument, cdpath being set to ."
       
    33 cdpath=.
       
    34 cd popfdtest
       
    35 ret=$?
       
    36 if [ $ret -eq 1 ]
       
    37 then
       
    38     echo "PASS"
       
    39     let passno=passno+1
       
    40 else
       
    41     echo "FAIL: Expected return value 1, but  returned $ret"
       
    42     let failno=failno+1
       
    43 fi
       
    44 cdpath=
       
    45 }
       
    46 
       
    47 test_cd2()
       
    48 {
       
    49 let totalno=totalno+1
       
    50 echo "Test $totalno: cd with a "nonexistingdir" as argument, cdpath being set to ./dirstest "
       
    51 cdpath=./dirstest
       
    52 cd popfdtest
       
    53 ret=$?
       
    54 if [ $ret -eq 1 ]
       
    55 then
       
    56     echo "PASS"
       
    57     let passno=passno+1
       
    58 else
       
    59     echo "FAIL: Expected return value 1, but  returned $ret"
       
    60     let failno=failno+1
       
    61 fi
       
    62 cdpath=
       
    63 }
       
    64 
       
    65 test_cd3()
       
    66 {
       
    67 let totalno=totalno+1
       
    68 echo "Test $totalno: cd with a unix style directory as an argument"
       
    69 cd cdtest
       
    70 if [ $PWD = "C:\zsh\cdtest" ] || [ $PWD = "E:\zsh\cdtest" ] || [ $PWD = "Z:\zsh\cdtest" ]; then
       
    71     echo "PASS"
       
    72     let passno=passno+1
       
    73 else
       
    74     echo "FAIL: Expected return value 1, but  returned $PWD"
       
    75     let failno=failno+1
       
    76 fi
       
    77 cdpath=
       
    78 }
       
    79 
       
    80 postamble()
       
    81 {
       
    82 cd ..
       
    83 rmdir dirstest
       
    84 rmdir cdtest
       
    85 }
       
    86 report()
       
    87     {
       
    88     echo "#############################################################################"
       
    89     echo "Total tests : $totalno"
       
    90     echo "Passed      : $passno"
       
    91     echo "Failed      : $failno"
       
    92     echo "#############################################################################"
       
    93     }
       
    94 
       
    95 init
       
    96 preamble
       
    97 test_cd1
       
    98 test_cd2
       
    99 test_cd3
       
   100 postamble
       
   101 report
       
   102